Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to do image animation in Beamer

📅 2010-Feb-09 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

Beamer makes it very easy to include a series of images and display them in a serial animated style in separate frames (slides).

For example, to display the images foobar-0.png, foobar-1.png and foobar-2.png in a serial fashion use:

\usepackage{xmpmulti}
\begin{frame}
\multiinclude[format=png]{foobar}
\end{frame}

xmpmulti is a package that ships along with the Beamer package. \**multiinclude** is the command that takes care of putting the foobar-x.png into different frames. Make sure that the files are named as basename-number.format, i.e., the basename and the number are separated by a hyphen. The format option is the extension of the files.

\multiinclude starts from file number 0. To start from a different number, say 9:

\multiinclude[format=png,start=9]{foobar}

\multiinclude inserts all files that are in the above format. To make it stop at a certain number, say 7:

\multiinclude[format=png,end=7]{foobar}

Typically, images are inserted using the \includegraphics command. The settings passed to \includegraphics can be passed to \multiinclude using its graphics option. For example, to set the scale of the image to 0.3:

\multiinclude[format=png,graphics={scale=0.3}]{foobar}

By default, the images are placed one on top of another. To replace each image by the next image try:

\multiinclude[<+>][format=png]{foobar}