Graphics, Figures & Tables ⇒ What size to compress images to?
What size to compress images to?
I've recently started using Latex and adding graphics with the graphicsx package. I've found that Latex is rather poor at upscaling images so I've tended to include image files with a larger resolution than I expect is required. The problem is, my PDF files are now massive and impractical to email out. This got me wondering: what size is best to include images?
Say I want an image to be as wide as the text, is the following thinking correct?
Assumptions
Image Width = 18cm (max)
Printer resolution = 150 dpi (is the the average printer resolution?)
1 inch = 2.5cm
So,
18cm = 7.2 inches = 1080 dots....
IE - My images should have a width of around 1000 pixels?
Thanks!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Re: What size to compress images to?
Re: What size to compress images to?
I'm writing a report that will be printed and also emailed out, so I suppose I'll have to keep the high quality images. Unless there's a way / package to create PDFs optimised for each purpose?
Also, did my rough calculation method sound right? i.e. dpi = number of pixels in a one inch line
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
What size to compress images to?
You have to take the relation between postscript point (also called big point) and pixel into account. Therefore pixel based graphics have to be scaled to three quarters of their size for proper appearance in the final output (see Forum Search for details, keyword »postscript point«).RiW wrote:[…] Also, did my rough calculation method sound right? i.e. dpi = number of pixels in a one inch line
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
What size to compress images to?
Yeah, it is possible. You may use different file types for different purpose (but with same names), let's say, high-resolution .png files for printing, and low-resolution .jpg files for reading from screen. Now, all you have to do is to omit the extension of the picture when including it in the document, e.g., use: \includegraphics{my_picture} instead of: \includegraphics{my_picture.png}.RiW wrote:Thanks for that.
I'm writing a report that will be printed and also emailed out, so I suppose I'll have to keep the high quality images. Unless there's a way / package to create PDFs optimised for each purpose?
To decide which format should be used when compiling your document, you may change the extension list. Add the following code into your preamble:
Code: Select all
\DeclareGraphicsExtensions{.png,.jpg,.pdf}
There is also another way: keep pictures in two different subfolders, e.g., A and B, then use a custom command, something like this:
Code: Select all
\newcommand{\mypic}[1]{\includegraphics{./A/#1}}
Re: What size to compress images to?
Thanks again!