pts / pdfsizeopt

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

optimization of images with /Metadata or /SMask references #136

Closed rbrito closed 1 year ago

rbrito commented 4 years ago

Hi, @pts.

First of all, this is a different bug from #133, despite having similar symptoms.

I just discovered that if a CCITT image has a dictionary with a /Metadata key in it, then pdfsizeopt doesn't optimize such image.

I'm attaching here some PDF files that show this issue. If you could help with this, it would be awesome.

01-before.pdf 01-before.pso.pdf 02-after-removing-1st-metadata.pdf 02-after-removing-1st-metadata.pso.pdf 03-after-removing-all-metadata.pdf 03-after-removing-all-metadata.pso.pdf

Thanks,

Rogério Brito.

rbrito commented 4 years ago

I just discovered the issue with pdfsizeopt skipping those images (the metadata was indirect and pdfsizeopt was skipping anything with an indirect information after doing the basics with images).

I wrote a fix to this situation here: https://github.com/rbrito/pdfsizeopt/commit/a742cf286c77ec8ed2902f01c000417f74a35531

If you would like me to send a pull request, please let me know (this would be my first contribution to pdfsizeopt).

Thanks,

Rogério Brito.

pts commented 1 year ago

Thank you for reporting this! Fixed in 7572ebf8088c0a23322a7c107a639519c3531d70.