I found myself in a situation recently, where somebody wanted to create a Powerpoint slideshow for a hundred or so photos, all with the same header and footer. I thought it might be a lot easier to produce the file using Latex, and indeed it was. This is what I did.
The steps shown here include resizing and renaming the photos first.
I am assuming that you have all your images in the directory images
I used the Imagemagick mogrify
command to bulk resize all the images. This command resizes all images to a maximum size of 1280×1024, but does not resize them if they are already smaller than that.
mogrify -resize 1280x1024\> images/*
The following Perl script renames all the files sequentially. This makes it easier to include them in the Latex script. See this Stackoverflow question for more details.
#!/usr/bin/perl use strict; use warnings; use File::Temp qw/tempfile/; my $dir = $ARGV[0] or die "Please specify directory as first argument"; opendir(my $dh, $dir) or die "can't opendir $dir: $!"; # First rename any files that are already numeric while (my @files = grep { /^[0-9]+(\..*)?$/ } readdir($dh)) { for my $old (@files) { my $ext = $old =~ /(\.[^.]+)$/ ? $1 : ''; my ($fh, $new) = tempfile(DIR => $dir, SUFFIX => $ext); close $fh; rename "$dir/$old", $new; } } rewinddir $dh; my $i; while (my $file = readdir($dh)) { next if $file =~ /\A\.\.?\z/; my $ext = $file =~ /(\.[^.]+)$/ ? $1 : ''; rename "$dir/$file", sprintf("%s/%s%s", $dir, ++$i, $ext); }
Save the above script and run:
./rename.pl images
You should now have all your images as 1.jpg, 2.jpg and so on.
Save the following Latex script as slides.tex
. Comments being with a %
.
\documentclass{beamer} \usepackage[size=a4]{beamerposter} \usepackage{pdfpages} \usefonttheme{professionalfonts} % using non standard fonts for beamer \usefonttheme{serif} % default family is serif \usepackage{fontspec} \usepackage{pgffor} \setmainfont{Source Sans Pro Light} \usepackage{graphicx} \begin{document} % Uncomment the following to insert a title image without header and footer text % \begin{frame} % \transduration{1.5} % \transglitter % \begin{figure} % \includegraphics[height=20cm]{another-image-file} % \end{figure} % \end{frame} \foreach \n in {1,...,11}{ \begin{frame} \transduration{1.5} % Duration between slides \transglitter % Transition effect % \includegraphics{logo}\hspace{2cm} % Optional: add a logo at the top of each slide {\LARGE\textbf{Here is a header for each page}}\newline \begin{figure} \includegraphics[height=14cm]{images/\n} \end{figure} Here is some small footer text \end{frame} } \end{document}
Run the script. xelatex
is used so that fonts can be used:
xelatex slides.tex
This will produce slides.pdf
. This file can be opened with Adobe Acrobat and shown in full screen to see the slideshow with transitions. As much as I dislike the proprietary Adobe viewer, it does show the slideshow well, which not many other PDF viewers seem to support.