7

I noticed that clipping images with \includegraphics' viewport does not reduce the file size of generated PDF output. I might miss other settings.

Is it possible to reduce the file size of generated PDF by clipping the included images with \includegraphics' viewport?

Minimal Working Example might look like below:

\documentclass{article}
\usepackage{graphicx}
\graphicspath{{Images/}}
\begin{document}
\includegraphics[viewport=2cm 3cm 9cm 9cm,clip]{mb}
\end{document}
1
  • 1
    \includegraphics doesn't do anything to the included PDF; it just tells the PDF viewer to clip it.
    – egreg
    May 22, 2012 at 17:56

1 Answer 1

7

Clipping graphics or boxes is implemented at the driver level. That means that the entire original item is included in the output, and that the driver is then told only to make part of it visible. As such, clipping/viewports can never reduce file size.

For a vector graphic, the same would be true even if you made a standalone image and then included that in a second document. With a raster image, I suppose that one could clip the output, then use a graphics program to save the TeX output (say PDF) as a new graphic, then include that, but this would all be easier to do directly with a graphic tool from the original image.

3
  • Is scaling different thing? I noticed that scaling alters the file size. May 22, 2012 at 18:13
  • 1
    @Forgiver Without seeing an example, I'm not sure why you see differing file sizes when scaling. The code I'm familiar with again does a driver-based scale after including the 'raw' material.
    – Joseph Wright
    May 22, 2012 at 18:18
  • Just replace the content in the body of my MWE with \includegraphics[scale=0.1]{mb} where mb is an EPS image obtained by converting its original in JPG. May 23, 2012 at 3:17

You must log in to answer this question.

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