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

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}

-
\includegraphics doesn't do anything to the included PDF; it just tells the PDF viewer to clip it. – egreg May 22 '12 at 17:56

## 1 Answer

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.

-
Is scaling different thing? I noticed that scaling alters the file size. – kiss my armpit May 22 '12 at 18:13
@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 '12 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. – kiss my armpit May 23 '12 at 3:17