Copy link to clipboard
Copied
I'm confused about how InDesign compresses images in pdfs.
I have to submit 15 photos to a photography contest, so I put these 15 images (each image in its own page) in an InDesign document that has no more than these 15 pages. All the images have 2000 pixels in the larger side and have in average 689 KB.
In the Export to pdf dialog, I choose "Smallest file size" preset and JPEG compression (not JPEG (Automatic)) for both "Color images" and "Grayscale images".
However the resulting pdf size is aprox. 26 MB! I expect the pdf to be a little more than 689 KB * 15 = 10335 KB or 10 MB.
An inspection of the pdf with pdfimages, a tool from a pdf library called Poppler, reveals that only 3 out the 15 images are compressed with jpeg.
$ pdfimages -list mypdf.pdf
page num type width height color comp bpc enc interp object ID x-ppi y-ppi size ratio
--------------------------------------------------------------------------------------------
1 0 image 2000 1337 index 1 8 image no 78 0 72 72 2195K 84%
2 1 image 2000 1337 index 1 8 image no 4 0 72 72 2155K 83%
3 2 image 2000 1333 icc 3 8 jpeg no 8 0 72 72 120K 1.5%
4 3 image 1500 2000 icc 3 8 jpeg no 12 0 72 72 98.3K 1.1%
5 4 image 2000 1333 index 1 8 image no 16 0 72 72 1919K 74%
6 5 image 1334 2000 index 1 8 image no 20 0 73 73 2058K 79%
7 6 image 1500 2000 index 1 8 image no 24 0 72 72 1781K 61%
8 7 image 2000 1332 index 1 8 image no 28 0 72 72 1943K 75%
9 8 image 2000 1333 index 1 8 image no 33 0 72 72 2168K 83%
10 9 image 2000 1337 index 1 8 image no 37 0 72 72 2354K 90%
11 10 image 1500 1998 index 1 8 image no 41 0 72 72 2080K 71%
12 11 image 1500 2000 index 1 8 image no 45 0 72 72 1869K 64%
13 12 image 2000 1339 index 1 8 image no 49 0 72 72 2465K 94%
14 13 image 2000 1332 icc 3 8 jpeg no 53 0 72 72 120K 1.5%
15 14 image 1337 2000 index 1 8 image no 57 0 72 72 2381K 91%
Inspecting each image in detail, I found that the 3 images that were compressed with JPEG have more than 256 unique colours, while the others have exactly 256 unique colours. Also notice that the images that have 256 unique colours have an "Indexed color space" in the pdf.
Using LibreOffice writer, a word processor commonly used in Linux distributions, I could export to a 8,2 MB pdf.
So my questions.
How can I instruct InDesign to compress with JPEG all the images and not only ones that have more than 256 colours?
Is this an expected behaviour of the pdf compression process in InDesign?
Thank you all in advance.
Copy link to clipboard
Copied
This sounds entirely expected (if also surprising). JPEG is designed specifically and exclusively for photographs (the P in the name) and is effective on real world images with lots of very similar colours that gradually change. It cannot effectively compress images with a few very different colours; they would often be catastrophically bad or huge. So a good PDF producer won’t even try. Typically ZIP is used but compression may be negligible or negative in some cases. Remarkably, LibrePDF apparently succeeds in this case by ignoring indexed colour anyway, which Acrobat won’t do.
Copy link to clipboard
Copied
Thank you very much for your response.
As a user I would like to force the pdf producer to use JPEG anyway, by setting an advanced option that would warn me of the possible effects of using JPEG in images with few distinct colours.
In my case, the JPEG compression that LibreOffice writer applied to the images with 256 colours was pretty fine and showed no differences (perceptually) with the images with more than 256 colours.
Considering this behaviour, I don't know of any workflow involving InDesign that would allow me to produce small sized pdfs with images that have 256 colours.
Kind regards,
diego
Copy link to clipboard
Copied
Just to double check, if you open one of the files that are listed as index into Photoshop does the title bar show (RGB/8) after the title and not (Index)?
Copy link to clipboard
Copied
Hi rob_day.
It shows RGB/8# in images with more than 256 unique colours (first screenshot) and images with just 256 unique colours (second screenshot)
Kind regards,
diego
Copy link to clipboard
Copied
Is there a reason you are using index color? If you inspect an index image in AcrobatPro the compression method is zlib/deflate not JPEG. I think you will get better compression leaving the images as 8-bit per channel:
Copy link to clipboard
Copied
Hi rob_day.
I'm not using Indexed Color. All the images used in the InDesign document have sRGB with 8 bit per channel. Apparently the pdf producer (InDesign in this case) chooses to encode images that have 256 unique colors with an Indexed Colorspace when it exports to pdf. Images with more than 256 unique colors are encoded with sRGB and compressed with JPEG.
Kind regards,
diego