To crop an image, the command \includegraphics*[clip=true, viewport=0 0 10 10]{...} looks great, but the image is not really cropped.
The image at full resolution is included in the PDF and can be accessed by copy/past.
Of course, I can first reduce/crop my image with Gimp, but I'm looking for alternatives solutions.
Is it possible to really crop the image with LaTeX, and reduce the PDF size?
(I have the same problem with reduced picture[width=10%] )
Maybe with TikZ ???
Tks,
Vincent
Graphics, Figures & Tables ⇒ How to crop images to reduce PDF size
NEW: TikZ book now 40% off at Amazon.com for a short time.

- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
How to crop images to reduce PDF size
As far as I know this is not possible. LaTeX processes an external graphics file as is and doesn't care about its size.120 wrote:[...] Is it possible to really crop the image with LaTeX, and reduce the PDF size? [...]
I don't see where pgf/tikZ could be helpful in this case.120 wrote:[...] Maybe with TikZ ?[...]
Best regards and welcome to the board
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
How to crop images to reduce PDF size
The image at full resolution?
This puzzles me. If this image in question is a raster graphic, it's not clear to me why you'd need to use the PDF format for it, nor what the problem would be with cropping it with the GIMP.
If the image is vector based, then the concept of "resolution" doesn't really apply to it. (Or at least, it hardly effects how big the file is.)
Where and how did you acquire this PDF image? If you only need part of it, the best thing to do would be to go back to the source and delete the stuff from it that you're not going to use before exporting to PDF.
If you only have it in PDF format, and it's vector based, that's a bit tricky. Your latex distribution probably comes with the pdfcrop tool -- though that's mainly used for removing whitespace, which will not have an appreciable effect on file size.
I sometimes use the pdfmanipulate command line tool that comes with calibre for cropping parts of PDF beyond whitespace, but I've never really paid any attention to its effect on the file size.
This puzzles me. If this image in question is a raster graphic, it's not clear to me why you'd need to use the PDF format for it, nor what the problem would be with cropping it with the GIMP.
If the image is vector based, then the concept of "resolution" doesn't really apply to it. (Or at least, it hardly effects how big the file is.)
Where and how did you acquire this PDF image? If you only need part of it, the best thing to do would be to go back to the source and delete the stuff from it that you're not going to use before exporting to PDF.
If you only have it in PDF format, and it's vector based, that's a bit tricky. Your latex distribution probably comes with the pdfcrop tool -- though that's mainly used for removing whitespace, which will not have an appreciable effect on file size.
I sometimes use the pdfmanipulate command line tool that comes with calibre for cropping parts of PDF beyond whitespace, but I've never really paid any attention to its effect on the file size.
Re: How to crop images to reduce PDF size
My images are many png files 1024*768, come from an external tool.
I want to include small thumbnails in my PDF.
I can't use Gimp (or ImageMagick) because I need some others informations (\pagewidth, \textwidth, ...) which are only available in Latex.
You said that latex is not a graphic tool and that it use images as is !
But with tikz, the command
\node[cm={....}]{\includegraphics{...}};
will really transform the image.
A rectangle will become a parallelogram.
The images stored inside the final PDF is transformed.
I can use it for resizing, but not for cropping.
Thanks for your time.
I want to include small thumbnails in my PDF.
I can't use Gimp (or ImageMagick) because I need some others informations (\pagewidth, \textwidth, ...) which are only available in Latex.
You said that latex is not a graphic tool and that it use images as is !
But with tikz, the command
\node[cm={....}]{\includegraphics{...}};
will really transform the image.
A rectangle will become a parallelogram.
The images stored inside the final PDF is transformed.
I can use it for resizing, but not for cropping.
Thanks for your time.
How to crop images to reduce PDF size
What I had in mind was that you would use the GIMP to create cropped or edited versions of your images, and then you can use LaTeX to insert the edited versions in your document.120 wrote:I can't use Gimp (or ImageMagick) because I need some others informations (\pagewidth, \textwidth, ...) which are only available in Latex.