6.7 plasTeX.Imagers — The plasTeX Imaging Framework

The imager framework is used when an output format is incapable of representing part of a LaTeX document natively. One example of this is equations in HTML. In cases like this you can use an Imager to generate images of the commands and environments that cannot be rendered in any other way.

Currently, plasTeX comes with several imager implementations based on dvi2bitmap (http://dvi2bitmap.sourceforge.net/), dvipng (http://savannah.nongnu.org/projects/dvipng/), and ghostscript with the PNG driver (http://www.cs.wisc.edu/~ghost/doc/GPL/index.htm) called gspdfpng and gspspng, as well as one that uses OS X’s CoreGraphics library. Creating imagers based on other programs is quite simple, and more are planned for future releases.

In addition to imagers that generate bitmap images, it is also possible to generate vector images using programs like dvisvg (http://dvisvg.sourceforge.net/) or dvisvgm (http://dvisvgm.sourceforge.net/).

The Imager framework does all of its work in temporary directories the one requirement that it has is that Imager subclasses need to generate images with the basenames ‘img%d’ where ‘%d’ is the number of the image.

The only requirement by the plasTeX framework is that the imager class within the imager module is called “Imager” and should be installed in the plasTeX.Imagers package. The basename of the imager module is the name used when plasTeX looks for a specified imager.