I am writing a report that includes a results section with a lot of generated images. These images are .png files. Judging by the file size of the resulting pdf, these images are included in their entirety, even when they are resized and clipped (trimmed).

An image of 4MB will increase the size of the resulting pdf by about 4MB, regardless of the fact that I only show half of the image and the image is greatly downscaled.

I'm using:

    clip,trim=700 0 700 300]

In my case, this leads to a pdf that is over 100MB. How can I tell LaTeX to compress the images or discard the parts that are not shown?

I know I can print it afterwards with a pdf-printer and it will reduce the file size to about 20MB (which is a lot smaller than 100MB) but I would rather not have this intermediate step. Why can't pdfLaTeX reduce this file size too?

  • What kind of images are these? Could you opt for a pure vector-format version of these images? It would help if you could provide an example.
    – pluton
    Commented Jun 16, 2014 at 19:21
  • These are dental radiographs that are being processed by some code. Vector-format is not possible, but I could rerun my code and save them in a more compact format. Since the report does not need full detail images, I guess even a lossy format like .jpg might suffice. But I would like to hear if there are solutions, because next time I need something similar, I might not have this luxury.
    – neXus
    Commented Jun 16, 2014 at 19:40
  • 2
    See tex.stackexchange.com/q/56936/21344 --- pdflatex cannot directly modify the included image data. You must either pre-process the included png files or post-process the resulting pdf (one option: tex.stackexchange.com/a/19047/21344). Commented Jun 16, 2014 at 20:01

1 Answer 1


A TeX compiler is not an image processing program. The image is just included in total. Trimming/clipping is applied via PDF (PostScript) operators without changing the image.

Load the image into an image processing program (gimp or many other), remove the unwanted parts there. Depending on the image, it could also be downscaled or exported in a different format such as JPEG (lossy). Then it also simplifies the including in LaTeX, because option trim or viewport with its coordinates are not needed any longer.

  • ctan.org/pkg/pdflatexpicscale (which did not yet exist at the time of your answer) provides a way to downscale the images according to their use in the tex/pdf file. With this, you can keep a backup of the original images, downscale as needed, change your tex file/required image size, again downscale the original images to the new required size - some coding will even get an automated solution. The clipping must be done "by hand" before, nevertheless.
    – Stephen
    Commented Feb 27, 2021 at 11:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .