Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there any way to include an animated GIF directly in either PDFLaTeX or XeLaTeX? I realize the animate package can include animations in a PDF, but it doesn't support animated GIFs and you have to split them up manually into EPS or PNG files as far as I can tell.

share|improve this question
2  
What is the problem with splitting the gif first? The manual part of the job is to enter something like `convert my.gif my.png' at the command line. –  AlexG Nov 15 '10 at 12:34
4  
It's a pain in the butt! –  ptomato Nov 15 '10 at 12:36
2  
In this case, I recommend to abstain from using computers. –  AlexG Nov 15 '10 at 12:43
5  
There was really no reason for that. I think my question is perfectly legitimate - I'm asking whether there is any way to do it without splitting the GIF by hand. "No" is a perfectly reasonable answer. –  ptomato Nov 15 '10 at 12:46
4  
+1 I think it's a good question. –  Geoff Mar 30 '11 at 17:27

2 Answers 2

up vote 13 down vote accepted

Yes, use the movie15 package (in Latex), which supports GIFs directly. You will need to use a PDF viewer that has the right plugin to supported GIF animations.

Note on media9

The movie15 package has been marked deprecated on CTAN for some time in favour of the media9 package, because media9 uses the better supported approach to embedding media of Adobe's Rich Media Annotations, rather than the old, ad-hoc, plug-in based approach of media15. This has the consequence that building rich media documents in media9 is a more flexible process, supporting several workflows, and the results typically can be displayed with more viewers. However, media9 does not support animated GIFs - the GIFs would have to be converted to a supported format such as FLV or MP4 before embedding.

share|improve this answer
19  
What – I can't get animations on paper? They do have that in the Harry Potter movies. Why can't we? –  Harald Hanche-Olsen Nov 15 '10 at 10:57
9  
@Harald: yes, paper is a sort of PDF viewer, but it's hard to find paper that supports animated content. I've had no personal experience with magic paper. I'd love to hear of other people's... –  Charles Stewart Nov 15 '10 at 11:18
6  
@Charles: Oh, it's been around for a while. Remember the old comics when you need to flip quickly through the pages to see an animation effect? Now, I'm sure some journals would object heavily to my 1200+ page manuscript containing 60s of video @ 24 fps.. –  Martin Tapankov Nov 15 '10 at 13:34
6  
@Martin: You are quite right! Someone must write a printer driver that creates flip books when given an animated GIF. –  Charles Stewart Nov 16 '10 at 10:19
1  
Now should we use the media9package instead ? –  Stéphane Laurent Aug 21 '13 at 15:22

For animated GIF, package animate should be used. Animated GIF sequences tend to be short and don't justify a video embedding package, such as media9, that embeds a videoplayer component alongside the sequence and which requires the GIF to be transcoded into MP4 first.

animate is a lightweight alternative with the bonus of producing embedded animations that work in AR versions for Win, OSX and Linux, while media9 embedded video only works in AR for Win and OSX. For use with animate, the GIF must be split into a PNG or JPEG sequence, optimized GIF must be un-optimized first:

These are the steps for a 100 frames animated GIF, using package animate and playing at 12 frames per second:

  1. gifsicle --unoptimize animated.gif | convert - frame-%d.png

  2. \animategraphics[loop,autoplay]{12}{frame-}{0}{99}


With the deprecated movie15 package it was, at least theoretically, possible to embed animated GIF without preprocessing. This method depended on the availability of a third-party plugin, some QickTime component to be specific, used by AR for displaying the GIF. This never worked reliably, though.

share|improve this answer
    
Animated GIFs can be embedded in PDFs using the pre-v9 plugin model. –  Charles Stewart Jan 13 at 23:48
    
@CharlesStewart. This uses a QuickTime sub-plugin. I never got it reliably working. –  AlexG Jan 14 at 7:08
    
Right - problems with plugins are the reason why the annotations model was introduced with the PDF v9 standard, and the reason that CTAN deprecates movie15. But they are supported in the PDF spec, so what the qn wants is possible. –  Charles Stewart Jan 14 at 8:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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