I'm very new to presentations in LaTeX (I've been using PowerPoint for years but have finally converted).

I am wondering how to get a GIF into a section. If need be, I can convert a GIF into lots of pictures and have them overlay to give the impression of movement.

  • Yeah, if you mange to convert into "normal" pictures, than it is quite easy to include them with \multiinclude – samcarter_is_at_topanswers.xyz Apr 23 '15 at 19:20
  • How does one split my gif into images? – iluvLatex Apr 23 '15 at 19:34

1. Convert and split animated GIF into PNG sequence

convert -coalesce something.gif something.png


magick convert -coalesce something.gif something.png

convert/magick convert is a command line tool from the ImageMagick.org software package. The command name depends on the software version.

This produces a set of numbered PNG files something-0.png, ..., something-16.png (Here, the original GIF http://i.stack.imgur.com/VHJmL.gif, renamed to something.gif consists of 17 frames.) Option -coalesce is necessary to undo a possible optimization of the original GIF file.

2. Get original animation speed

magick identify -verbose something.gif | grep 'Delay'

Users of Windows may want to run

magick identify -verbose something.gif | sls -Pattern 'Delay'

in the PowerShell.

This outputs lines (one for every frame) like:

Delay: 10x100
Delay: 10x100
Delay: 10x100

The frame rate (frames per second), to be passed as an argument to the \animategraphics command below, is found by dividing the number after x by the number in front of it:

frame rate = 100 (tics/s) / 10 (tics/frame) = 10 frames/s

3. Embed PNG sequence as an embedded looping animation in the final PDF

(This kind of animation requires a JavaScript-supporting PDF viewer, such as Acrobat Reader or KDE Okular.)


\begin{frame}{Embedded Animation}

Argument {10} sets the desired frame rate (frames per second), {0} and {16} set the first and last file numbers of the PNG series to be included in the animation. Note that frame rates above 30 FPS, if at all achieved by the PDF viewer, do not make much sense. 30 FPS is a typical value in video encoding. Use command option measure and the + button to see which frame rates are possible. They may depend on the image size and of course on the hardware on which the PDF viewer is running.

enter image description here

| improve this answer | |
  • 10
    @user4417 You need Acrobat Reader. – AlexG Mar 22 '16 at 7:28
  • 2
    @user4417 You will also need the most recent animate package version 2016/03/15 . – AlexG Mar 22 '16 at 11:11
  • 4
    @Royi The question is rather: Does the PDF standard support APNG? The answer is 'No'. You must convert it into a series of images and use one of the suggested methods (multipage PDF or animate-based animation). – AlexG Aug 28 '17 at 15:55
  • 2
    The PDF format and its viewer are Adobe inventions. I think they still define and extend the standard, although PDF is now an ISO standard. – AlexG Aug 28 '17 at 16:07
  • 2
    For someone else who stumbles upon this: The {0}{16} describes the first and last frame of the animation. You'll need to identify something.gif to determine how many frames are in the gif – inspectorG4dget Sep 18 '17 at 17:45

Ok, let's start with the .gif from @SeanAllred comment.

First Step: Converting

There are probably many methods to do so. To be independent of the operation system, there are online converter, like http://gifmaker.me/exploder/

or if you prefer using the command line use convert from ImageMagick:

convert -coalesce VHJmL.gif something.png

Make sure you resulting images are named something-0 and so on.

Second Step: multiinclude


    %asuming you images are called "something-0.png" up to "something-16.png" 
        \multiinclude[<+->][format=png, graphics={width=\textwidth}]{something}


enter image description here

| improve this answer | |
  • 2
    i.stack.imgur.com/VHJmL.gif – Sean Allred Apr 23 '15 at 22:18
  • 4
    It (the PDF) doesn't loop :-( – AlexG Apr 24 '15 at 14:38
  • 8
    I get a slide per png file, but no animation. I can advance the "animation" myself, but then there are pauses and white screens. – user4417 Mar 22 '16 at 2:35
  • 5
    @Dr.ManuelKuehner The animate approach is very smooth on Linux. Static, in fact. :( – cfr Jun 10 '18 at 21:48
  • 2
    @Dr.ManuelKuehner On the other hand, this method is also static - there's just more that is static. :( – cfr Jun 10 '18 at 21:52

Have a look at pdfpc they have an example how to embed videos. pdfpc is a tool for displaying your beamer presentations.

It doesn't work with gifs but you can still convert something.gif something.avi. To get a preview picture run convert something.gif something.png




Display your presentation with pdfpc my-presentation.pdf

It doesn't seem to work if your video is in another directory set by \graphicspath.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.