TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to clip a figure inserted with \includegraphics to contents? That is, remove all surrounding whitespace.

share|improve this question
Please, do not forget that when you clip/crop a pdf file containing vector-like data, you do not reduce the size of the file. For instance, if you want to zoom into a big image, the big image will be stored in your final file even though a small portion only will be visible. This may also hold true for raster images. If you just want to reduce white space, it is ok. – pluton Jan 11 '11 at 21:30
up vote 11 down vote accepted

If your figure is in pdf format, use pdfcrop to automatically crop all whitespace before inserting it.

If it's not in pdf format - you could create a pdf of it before. ;-)

Though there are graphic software tools to crop jpg and png as well. For example, ImageMagick with convert -trim filename on the command prompt.

share|improve this answer
pdfcrop is just what I needed, thanks :) – Marin Jan 11 '11 at 20:32
\includegraphics[viewport=llx lly urx ury, clip]{file}
\includegraphics[trim=llx lly urx ury, clip]{file}
share|improve this answer
I know this, but I have to open the file, look for coordinates... – Marin Jan 11 '11 at 20:29
@Marin: no, with package overpicyou can get a temporay grid – Herbert Jan 11 '11 at 21:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.