A Quick Guide to Using Compressed Graphics in L^{A}TEX 2ε

R W Kaszeta

October 27, 1997

Introduction

On occasion, you may need to create a L^{A}TEX 2ε document which includes a number of large graphics images (for example, my thesis includes almost 25 megs of graphics). A little known feature of the L^{A}TEX 2ε graphicx package is that you can actually work with gzip-compressed postscript images (.eps.gz) instead of uncompressed files (.eps). The steps for doing this are described in both the graphicx documentation and the L^{A}TEX Graphics Companion, but for simplicity I decided to write a short tutorial on doing this.

Including Compressed .eps Images

To include compressed images you have to follow a couple of steps:

1. The images must be in Postscript (.ps) or Encapsulated Postscript (.eps) format. For images not in this format, you should use the netpbm tools or xv to convert the image

to .eps.

2. You must use either the graphics or graphicx package. These methods don’t with with the psfig or epsfig packages (which are obsolete anyway, so you shouldn’t be using them).

3. You need to compress the graphics file using gzip:

gzip -9 file.eps

4. For L^{A}TEX to be able to process the compressed graphics file, you need to create a “Bounding Box” file (.bb), with the sizing information of the image. The “Bounding Box” is described in the .eps file with a line like

%%BoundingBox: 71 492 439 721

The simplest way to create the bounding box file is to use zgrep:

zgrep BoundingBox file.eps.gz > file.eps.bb

5. Finally, you need to replace the \includegraphics commands in your .tex file to look for just the base filename instead of the filename plus extension. For example, if the original line was

\includegraphics[scale=0.5]{file.eps}

the new line should read

\includegraphics[scale=0.5]{file}

If you do all these steps properly, L^{A}TEX, xdvi, and dvips should all work properly with the compressed files, saving a large amount of disk space.

Questions/Problems?

Contact kaszeta@me.umn.edu.