psfixbb - fix the BoundingBox in a Postscript file.


psfixbb [-ceflr] [-x N] [-o outfile] filename [filename...]


psfixbb is a tool to create a BoundingBox in Postscript(R) files which do not have one, or to fix an incorrect existing BoundingBox.

Many applications write Postscript(R) files or Encapsulated Postscript(R) files with no or incorrect BoundingBox information. I.e. the box which contains the image or text on the page is often smaller than specified in the %%BoundingBox comment in the file. This can be annoying when importing the file into other documents. psfixbb computes the size of the used part of a page and inserts the information into the file.

psfixbb uses ghostscript (gs) to transform the page into a portable bit map (pbm), then the pnmfile and pnmcrop utilities to determine the size of the non-white part of the page. These three programs need to be installed for psfixbb to work.

Because psfixbb really looks at the dark pixels of the page, it works even if the application which produced the Postscript file has painted the backgroud of the whole page white. Most other boundingbox-fixing utilities fail in such cases.

For landscape files you need to run psfixbb with the -r switch.


Send a new file with the correct BoundingBox to stdout. This will leave the original file untouched. Only the first filename on the command line will be processed.

When the filename extension is .ps, change it to .eps (unless the resulting file name corresponds to an existing file). See also the -f flag.

When specified together with the -e flag, existing .eps files are overwritten when necessary.

List computed BoundingBoxes, do not change any files.

-o outfile
Output to file OUTFILE.

Rotate the postscript file before attempting to compute the bounding box. Needed for landscape files.

-x N
The BoundingBox created can be made larger than the actual image by N postscript points with this option.


Carsten Dominik <>

Holger Karl <>

This program is free software. See the source file for the full copyright notice.


For the file, is used temporarily to hold a new version of the file with changed BoundingBox.


gs(1), pnmfile(1), pnmcrop(1), pnm(5)


psfixbb does not work for images larger than a normal page.

The file is overwritten without checking. For multipage documents, only the first page determines the value of the BoundingBox.


Thanks to Georg Drenkhahn for pointing out how to enforce a showpage command in gs.