pts / pdfsizeopt

PDF file size optimizer
GNU General Public License v2.0
750 stars 65 forks source link

PDF file containing JPEG images is not getting any smaller #147

Closed kylefoley76 closed 1 year ago

kylefoley76 commented 3 years ago

I tried to compress a PDF of 1.7 megs, the output was also 1.7 megs. I'm using a MacOS. PDF in question is attached. stace22.pdf

zvezdochiot commented 3 years ago

@kylefoley76 say:

stace22.pdf

String 17:

/Filter /DCTDecode

This is JPEG. See #95 .

rbrito commented 3 years ago

Using the scripts (using_pikepdf.py and optimize_jpegs.py) that I posted on a repository of mine, I can optimize the file to have 1168993 bytes. I'm attaching it here.

stace22.psom.pso.pdf

rbrito commented 3 years ago

These scripts of mine are to be used before a run with pdfsizeopt.

copyme commented 3 years ago

@rbrito cool very useful scripts!

pts commented 1 year ago

FYI New version of the scripts of @rbrito is available at: https://github.com/rbrito/scripts/blob/master/optimize_pdfs.py

Why doesn't pdfsizeopt make the attached PDF file much smaller? Because that PDF contains mostly JPEG images, and JPEG image optimization hasn't been implemented in pdfsizeopt yet (see https://github.com/pts/pdfsizeopt/issues/41 tracking it). See also https://github.com/pts/pdfsizeopt/issues/95 tracking lossy JPEG image optimization.