Home » » Bounding box for latex \includegraphics command

Bounding box for latex \includegraphics command

Type in a terminal window:
gs -sDEVICE=bbox -dNOPAUSE -dBATCH file.pdf (or file.ps)
you must have ghostscript installed of course. This command produces an output similar to this:

GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading NimbusRomNo9L-Regu font from /usr/local/share/ghostscript/fonts/n021003l.pfb... 2395104 1083573 3646208 1812428 1 done.
%%BoundingBox: 203 545 350 699
%%HiResBoundingBox: 203.356189 545.703241 349.560341 698.957486
Then in the latex manuscript you can include the graphic by using
\includegraphics[bb = 203 545 350 699]{pathToTheFile/File}
The four numbers correspond to the bottom-left corner (203,545) and the top-right one (350,699). You can clip or pad the picture by changing this numbers, for example, if you need to cut the bottom part, change ’545′ by say ’570′ and add the ‘clip’ option to the includegraphics command as
\includegraphics[bb = 203 570 350 699,clip]{pathToTheFile/File}
That would do.


Popular Posts