I'm trying to include GIF image in my LaTeX document. To my understanding this is possible. I'm using pdflatex and I get the following message:

ERROR: LaTeX Error: Unknown graphics extension: .gif.

And the figure I try is:


What am I doing wrong?

  • Where do you get your understanding from? It's wrong. – Reinstate Monica - M. Schröder Nov 15 '11 at 7:33
  • @MartinSchröder: In the above linked page it says '... and pdflatex will look for "figure.pdf", "figure.gif", or "figure.jpg".' Should be .png instead of .gif. – Martin Scharrer Nov 15 '11 at 7:57
  • @MartinScharrer: Well, that page is some years old. :-> But GIF was always wrong. – Reinstate Monica - M. Schröder Nov 15 '11 at 13:29
  • @MartinSchröder: gif was always wrong (as you say -- it was still covered by that stupid patent when pdftex appeared), but tiff (extension tif) was once valid. perhaps the site author was simply confused rather than just "plain wrong"? – wasteofspace Jun 14 '12 at 15:02

No, pdftex does not support GIF. Your online source is incorrect. See the pdftex manual, which is the ultimate guide here:

The image type is specified by the extension of the given file name: .png stands for png image, .jpg (or .jpeg) for jpeg, .jbig2 (preferred, but .jb2 works also) for jbig2, and .pdf for pdf file.

Simply convert your GIF to PNG. You won't be able to include animated GIFs or MPNGs directly, AFAIK.

The error you get is because there is no graphics rule set-up for .gif. You could define your own using \DeclareGraphicsRule, but there is no driver support for it, so that won't help you.

  • Last year I wrote my Ms.C. presentation in LaTeX (beamer) and I did include gif animation. could it be that I actually used XeLaTeX? – Yotam Nov 14 '11 at 11:27
  • 1
    XeTeX seems to support the GIF format. – Martin Scharrer Nov 14 '11 at 11:33
  • 5
    For animated GIFs, try the animate package. However, as GIF is not directly supported, convert animated GIFs to a sequence of numbered PNG files first using ImageMagick convert (convert in.gif out.png). Then animate this file sequence with aforementioned package. Works with XeLaTeX and others. – AlexG Nov 14 '11 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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