Images with 256 colors are not compressed with JPEG in exported PDF
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.
