toy / image_optim

Optimize images using multiple utilities
https://github.com/toy/image_optim
MIT License
1.52k stars 109 forks source link

Adding PDF optimizing #141

Open GantMan opened 7 years ago

GantMan commented 7 years ago

I had written an optimizer a while ago, much like image_optim. I love it!

One thing we added was PDF optimizations using qpdf. Perhaps that can get added to image_optim? I don't currently have the time, otherwise I'd add it myself.

qpdf --linearize "#{file}" "#{new_file}"

Thoughts?

toy commented 7 years ago

Thanks, Gant.

I already had a though about adding pdf optimisation and my main thoughts about this were something like: Pdf is a document format, even if part of pdf documents are just wrapping an image, so should an image optimiser take care of pdfs? And will not it lead to more non strictly image formats been optimised by image_optim.

But from current perspective - image_optim already handles svg format using svgo, and even if by definition it is an image format, it can contain text, so partially a document. So maybe yes, especially if images inside pdf can be optimised, but than this requires a investigation of possibilities and complexity.

GantMan commented 7 years ago

Take a playground round with qpdf. I had good results with it. Not sure what other tools are out there. But yeah, image_optim might need to become part of a toolset called assets_optim or something :)