[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

5. Graphics

`dvipng' attempts to handle graphics as included by the `graphicx' and `graphics' packages, without the need of specifying a driver to these packages. This means that it recognizes the encapsulated postscript inclusion meant for `dvips', but is also able (from version 1.8) to include bitmapped graphics, see the details below.


5.1 Encapsulated PostScript

When an EPS file is included, a call to GhostScript is performed to produce a bitmapped image that can be included. The default is to produce an image with transparent background, at the same size as the DVI page currently being converted to PNG, and include that as foreground on the PNG. Of course, if the image is to be cropped, that is done. The included image will be a truecolor image, so for maximum performance the output PNG will be in truecolor mode as well.

This conversion needs the `pngalpha' output device to be present in your copy of GhostScript. If that device is not present, or you use the `--palette' switch or request GIF output, the fallback is to use the `png16m' device to produce a cropped opaque image for inclusion. Other relevant switches are `--noghostscript' and `--nogssafer'. See section Option details.

The most common problem with including graphics is an incorrect bounding box. Complain to whoever wrote the software that generated the file if the bounding box is indeed incorrect. An adjusted boundingbox can be specified in the `\includegraphics' call, as in this example (using `graphicx'):

 
\includegraphics[bb=10 20 100 200]{imagename.eps}

5.2 Bitmapped graphics

dvipng can include PNG, JPEG and GIF graphics. When including such images via `\includegraphics' you need to specify the bounding box since TeX itself cannot read them from the files in question. The bounding box size should be given as `0 0 w h' in pixels, e.g., if the file `imagename.png' is 300x400 pixels, the inclusion would read

 
\includegraphics[bb=0 0 300 400]{imagename.png}

The default size is the image size in bp ("big points" in TeX nomenclature or PostScript points as other people have it, 72 per inch). That is, default resolution will be 72 dpi for included bitmaps, which is the default size in the few other bitmap-capable drivers that are known to me (dvipdfm and PDFLaTeX).

If you want 100 dpi you need to specify the width accordingly. You just divide your image width by 100: a 135 pixel wide image at 100 dpi will take up 1.35 inches. If you want 200 dpi you divide by 200, and so on. Simple, eh? The example above at 200 dpi would be 1.5 inches wide:

 
\includegraphics[bb=0 0 300 400,witdh=1.5in]{imagename.png}

[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on November, 11 2006 using texi2html 1.76.