Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
1  
\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
add comment

1 Answer

up vote 7 down vote accepted

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.

share|improve this answer
    
Is scaling different thing? I noticed that scaling alters the file size. –  Please don't touch May 22 '12 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 '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. –  Please don't touch May 23 '12 at 3:17
add comment

Your Answer

 
discard

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.