pts / pdfsizeopt

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

Adobe Acrobat Pro 11.0.20.17 displays the image incorrectly #131

Open jul059 opened 4 years ago

jul059 commented 4 years ago

pdfsizeopt on windows completely distorts the image in the sample pdf. It happens at least with the following commands:

--use-image-optimizer=ECT,jbig2 --use-image-optimizer=pngout,jbig2 no commands

sample.pdf sample optimized.pdf

EDIT: after opening the files in my browser, I realize this happens with Adobe Acrobat Pro 11.0.20.17 but not with Chrome or Firefox. Acrobat being a more complete program developed by the inventors of the pdf format, I think this is still a valid issue. Here's what it looks like:

image

pts commented 1 year ago

The optimized PDF file works for me in Chrome, Firefox, Evince and Ghostscript.

It looks like Adobe Acrobat has a bug rendering the /SMask image. Maybe the bug is related to /Filter/JBIG2Decode.

  1. Does pdfsizeopt --use-jbig2=no fix it for Adobe Acrobat?

  2. Have you tried reporting the bug to Adobe?

jul059 commented 1 year ago

The output is still distorted.

I have not reported it to Adobe. It may also have been fixed in a later version of Adobe Acrobat Pro, 11.0.20.17 is quite old. I don't have access to a newer version.

pts commented 1 year ago

Could you please send me a screenshot of this? sample.nosmask.pdf

jul059 commented 1 year ago

Could you please send me a screenshot of this? sample.nosmask.pdf

Adobe Acrobat Pro 11.0.20.17: image

pts commented 1 year ago

Adobe Acrobat Pro 11.0.20.17: image

Thank you, this is exactly how it looks for me in other viewers (e.g. Chrome).

It looks like that Adobe Acrobat Pro 11.0.20.17 has problems rendering the /SMask image, even if it's not JBig2-encoded.

Could you please upload the output PDF with pdfsizeopt --use-jbig2=no and a screenshot of Adobe Acrobat Pro 11.0.20.17 displaying it?

jul059 commented 1 year ago

With the 2017 binary of pdfsizeopt, it looks exaclty like the screenshot in the first post.

With the latest binary (v7), I get an error and no image is displayed: image

pts commented 1 year ago

Could you please upload the output PDFs you got in https://github.com/pts/pdfsizeopt/issues/131#issuecomment-1445206889 ? It's very interesting that that the output of two versions of pdfsizeopt behave differently in Adobe Acrobat Pro.

I have a suspicion on what can cause the problem. I'll give it a try after I get the PDFs. (My suspicion is that for Adobe Acrobat Pro to work, the /BitsPerComponent of the /SMask image must be either 8, or the same as /BitsPerComponent of the source image.)

jul059 commented 1 year ago

sample.pso.v7.pdf sample.pso.v8.pdf

They both display identical results (Comment 131).