Which graphics formats can be included in documents processed by latex or pdflatex?

Formats that work with LaTeX (dvi mode, using dvips):

  • eps

Formats that work with LaTeX (dvi mode, using dvipdfm(x)):

  • pdf
  • png
  • jpeg
  • eps

Formats that work with pdfLaTeX (pdf mode):

  • eps(*)
  • pdf
  • png
  • jpeg
  • jbig2

LuaTeX can also read

  • jpeg 2000

The reason for this way of working is that in dvi mode TeX simply leaves a space for the graphics. eps are included in the output by dvips.

pdfLaTeX includes graphics directly in the pdf, using the features available in that format. The pdf format can include other pdfs (no surprise), png, jpeg, jpeg2000 and jbig2 graphics. Although pdfTeX can't incorporate eps files directly, the set up in a modern TeX system will automatically convert them to pdf, and thus they are supported in practice.

XeTeX always uses the xdvipdfmx driver so has the same outcomes as using dvipdfmx with a classical DVI-based route.


Note that the LaTeX graphics package and associated helper code will search automatically for appropriate file extensions. As a result the extension should be omitted when including a graphic, for example

\includegraphics{foo}

for a file foo.eps. With a recent TeX system this will allow e.g. pdfLaTeX to auto-convert and .eps file to PDF format and find it 'auto-magically'.


Nowadays everything is actually very simple. In essence, you only need to worry about three different file formats:

  • PDF for vector graphics

  • JPEG for photos

  • PNG for other kinds of raster graphics.

pdflatex supports all of these, and virtually any graphics file can be converted to one of these formats.

And pdflatex not only supports these, but it does it extremely well. For example, a JPEG file is included in the resulting PDF file as is. It is not uncompressed and re-compressed; nothing is lost, and you know that including a 100 KB JPEG file in your document will enlarge the resulting PDF file by exactly 100 KB.

(With tools such as latex + dvips + ps2pdf, all bets are off; typically you will get huge PDF files or low-quality re-compressed JPEG files or both. But fortunately nowadays you can use almost always pdflatex instead of latex.)


This is not an answer to the question as asked, but I think it may be of use to those trying to work out which format to use and how to select it.

If you are using the graphicx package and your intention is to be flexible (in that you want to be able to produce different output formats from the same source file) then there is a simple way to avoid having to know which to use: if you leave off the file extension in the \includegraphics command then it selects the best one available according to the mode. Thus if you've got the .eps and the .pdf versions of the graphic available, then latex + dvips will choose the .eps whilst pdflatex will choose the .pdf. The command is:

\includegraphics{MonaLisa}

Which one it chooses is even customisable: there's a list of extensions for each output type and it goes through the list until it finds a file that exists. Redefining that list changes the priorities. The list is stored in a comma-separated macro called \Gin@extensions so redefining that will change the order. Here's a simple way to ensure that .pdf is selected first when producing PDF output (since, oddly, the list for PDF output starts with .png):

\documentclass{article}

\usepackage{ifpdf}

\ifpdf
\PassOptionsToPackage{pdftex}{graphicx}
\fi

\usepackage{graphicx}
\ifpdf
\makeatletter
\let\orig@Gin@extensions\Gin@extensions 
\def\Gin@extensions{.pdf,\orig@Gin@extensions} %prepend .pdf before .png
\makeatother
\fi
\begin{document}

\includegraphics{pullback}

\end{document}

For actually converting between formats, there are of course many ways to do that. TeXLive comes with a program epstopdf which converts an .eps file to a .pdf and there is even a LaTeX package epstopdf which will attempt to do the conversion for you (assuming that PDFTeX is allowed to do shell escapes) if it detects an .eps image!

For commandline conversion (ie on a U*nx system, including MacOSX), ghostscript can easily convert back and forth and comes with two scripts pdf2ps and ps2pdf that will do the conversion and the netpbm tools can convert between PDF, PS and lots of other graphics formats (of course there are many other such tools).

Thus by ensuring that you have each type of the image in the directory, you can be ensure that latex will pick up the right one for the right output.