[Tex/LaTex] Graphics file extensions and their order of inclusion when not specified

external filesgraphics

When using graphicx's \includegraphics you can specify the file extension or not. For generic use and perhaps portability, extensions are commonly dropped. The types of "approved" inclusions and their order of precedence depends on the driver/compiler being used. What are these driver-defaults?

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

Best Answer

pdftex.def

Version 2011/05/28 v0.06e

The list depends on

  • the version of pdftex.def,
  • the version of pdfTeX (temporarily TIFF was available, latest addition is JBIG2),
  • the version of the generated PDF (JBIG2 requires PDF 1.4).

For the current versions (2012) and PDF ≥ 1.4, the list is:

.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2

The order of the list is not optimal, it is a victim of compatibility.

The list can be extended by package epstopdf that adds .eps to the list and provide means to support further image formats.

dvips.def

Version: 1999/02/16 v3.01i

.eps,.ps,.eps.gz,.ps.gz,.eps.Z

Other supported extensions:

.pcx,.bmp,.msp,.pict,.pntg

dvipdfm.def

Version: 1999/9/6 vx.x (Bug: should be 1999/09/06)

.jpg,.jpeg,.pdf,.png

Also supported are EPS files.

dvipdfmx.def

Version: 1999/02/16 v3.0i

.pdf,.jpg,.jpeg,.png,.bmp,.ps,.eps,.pz,.eps.Z,.ps.Z,.ps.gz,.eps.gz

xetex.def

Version: 2009/11/22 v0.94

.pdf,.eps,.ps,.png,.jpg,.bmp,.pict,.tif,.psd,.mac,.sga,.tga,.gif

vtex.def

Version 2001/10/02 v7.45

.gif,.png,.jpg,.tif,.bmp,.tga,.pcx,.eps,.ps,.mps,.emf,.wmf
(also .tiff, .targa, .jpeg)

Other drivers in the graphics bundle

Version: 1999/02/16 v3.0i

dvipdf.def:  .eps,.ps,.eps.gz,.ps.gz,.eps.Z
dvipson.def: .eps,.ps,.pcx,.bmp (also .tif)
dviwin.def:  .eps,.ps,.wmf,.tif
emtex.def:   .eps,.ps,.pcx,.bmp
pctex32.def: .eps,.ps,.wmf,.bmp
pctexhp.def: .pcl
pctexps.def: .eps.ps
pctexwin.def: .eps,.ps,.wmf,.bmp
tcidvi.def:   <empty> (also .ps,.eps,.PS,.EPS and BMP)
truetex.def:  .eps,.ps (also .tif,.bmp)

List manipulation

I recommend package grfext for manipulating the list of graphics extensions.

  • Extensions can be added: \AppendGraphicsExtensions, \PrependGraphicsExtensions.
  • Extensions can be removed: \RemoveGraphicsExtensions.

For example, prefer vector graphics over bitmap graphics, indenpendent of the driver:

\documentclass{article}
\usepackage{graphicx}
\usepackage{grfext}

\AtBeginDocument{%
  \PrependGraphicsExtensions*{
    .mps,.MPS,.pdf,.PDF,.eps,.EPS,.ps,.PS,
    .png,.PNG,.jpg,.jpeg,.JPG,.JPEG,
    .funny,.foobar
  }%
  \PrintGraphicsExtensions % see .log file
}

\begin{document}
\end{document}

Package grfext prints the list in the .log file (example for pdflatex/TL2011):

Package grfext Info: Graphics extension search list:
(grfext)             [.mps,.pdf,.PDF,.eps,.png,.PNG,.jpg,.jpeg,.JPG,.JPEG,.jbig2,.jb2,.JBIG2,.JB2]

The star form of \PrependGraphicsExtensions only adds the extensions that are supported by the graphics driver.

Related Question