psfixbb - fix the BoundingBox in a Postscript file.


psfixbb [-cefl] [-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 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 real size of the used part of a page and sets the BoundingBox correctly. Normally the file itself is changed, but it is also possible to just compute the BoundingBox.

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


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.

Only useful when specified with -e flag. Then, existing .eps files are overwritten if necessary.

List computed BoundingBoxes, do not change any files.

-x N
The BoundingBox created can be made larger than the actual image by N points with this option. The default for N is 1. To make the BoundingBox minimal use -x0.

-o outfile
Write a new file outfile instead of changing the old file. Only the first file on the command line will be processed.



Carsten Dominik <>

This software is written in Perl and may be distributed under the same terms as Perl itself.


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


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


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