[Tex/LaTex] Is it possible to reduce the file size of generated PDF by clipping the included images with \includegraphics’ viewport

file sizegraphics

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}

Best 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.

Related Question