# What is the advantage of using \includegraphics instead of \pgfimage for ordinary image inclusion?

The TikZ & PGF manual says that ‘LaTeX’s \includegraphics is designed better than pgf’s image mechanism’ and that ‘LaTeX users are encouraged to use \includegraphics to include images.’ But is there any advantage of using \includegraphics instead of \pgfimage when not using any of the features exclusive to \includegraphics (such as clipping)?

The only differences I’ve found is that latexmk automatically recognises modified images when \includegraphics is used, but not when \pgfimage is used. On the other hand, \pgfimage supports the interpolate option, which is nice (though not widely supported in PDF readers). \pgfimage also supports masking, which \includegraphics does not. One last difference I’ve found is that \pgfimage only issues a warning, not an error, when a referenced image is not found. This may of course be both positive and negative; personally, I like it.

Are there any other important differences and advantages of using \includegraphics over \pgfimage?

-
Have a look at answers and comments here: How can/should I include annotated images?. –  Stefan Kottwitz Oct 28 '11 at 16:15

\pgfimage currently uses \includegraphics internally for every output format (i.e. driver) except for pdftex where it uses its own pdftex primitives to include the image (which are also used in \includegraphics BTW). A notable difference is that PGF provides different macros to declare the image first and then use it multiple times, while \includegraphics doesn't, nevertheless \includegraphics will also only store the image once in the PDF.

Note that since 2010/09/09 the pdftex driver for graphicx has supported the interpolate option. This isn't mentioned in the graphicx manual which seems to be frozen. I found it in the source file comments:

% 2010/09/09 v0.05a (HO)
% [..]
%  * Option `interpolate' added for bitmaps, see PDF specification.
%    Values are `true' or `false', default is `false'.

So you can use it as:

\includegraphics[interpolate=true]{<image>}
% or simply
\includegraphics[interpolate]{<image>}

Also a very big difference (IMHO) is that \includegraphics can use most of the new keys provided by my adjustbox package as long it is loaded with the export option. It provides frames, min/max sizes, multiple clippings, size adjustments, and more.

In summary, I think what is meant by the notice that "\includegraphics is designed better", is that it comes already with all needed drivers which are stable and tested through decades of usage. Apparently PGF doesn't have all its image related code finished for its driver files, otherwise it wouldn't fall-back to \includegraphics for most drivers.

-
Although it mentions "...see PDF specification", I have no idea where to start looking for that. Do you know what interpolate does to/for BMPs? –  Werner Oct 28 '11 at 17:36
@Werner: It interpolates the image (raster images only) when zoomed. You then don't see the pixels any longer if you use very high zoom factors. –  Martin Scharrer Oct 28 '11 at 17:37
You said that \includegraphics includes a multiple used image only once too. So if I like to include e.g. a (vector) logo in all footers it doesn’t matter wether I use \includegraphics or the PGF mechanism? –  Tobi Oct 28 '11 at 21:47
@Tobi: Yes, using \includegraphics in a header or footer with a vector or raster image will only include the image once, if you use pdftex. With PGF you should use \pgfdeclareimage once in the preamble and use \pgfuseimage in the header or footer. –  Martin Scharrer Oct 29 '11 at 0:07
Thank you :-) ... –  Tobi Oct 29 '11 at 10:05