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.

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:

\begin{figure}
  \centering
  \subfloat[]{\label{fig:a}}{\includegraphics[width=0.45\textwidth]{Safinya_lamelar.png}}
  \subfloat[]{\label{fig:b}}{\includegraphics[width=0.45\textwidth]{Safinya_hex.png}}
  \subfloat[]{\label{fig:c}}{\includegraphics[width=0.45\textwidth]{Farago_lamelar.gif}}
  \subfloat[]{\label{fig:d}}{\includegraphics[width=0.45\textwidth]{Farago_hex.gif}}
  \caption{Lipoplexes}
  \label{gene.fig1}
\end{figure}  

What am I doing wrong?

share|improve this question
    
Where do you get your understanding from? It's wrong. –  Martin 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. –  Martin 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

1 Answer 1

up vote 17 down vote accepted

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.

share|improve this answer
    
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
    
XeTeX seems to support the GIF format. –  Martin Scharrer Nov 14 '11 at 11:33
3  
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

 
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.