xqms / graphicscache

Caching & DPI control for the LaTeX graphicx package
BSD 3-Clause "New" or "Revised" License
9 stars 5 forks source link

support for png #15

Open hpvd opened 2 years ago

hpvd commented 2 years ago

awesome - just don't know what I like more: time saving when building document or size reduction of final pdf :D

what do you think of giving these possibilities also to png files? There are several uses cases where this filetype is "the better choice" Of course speed and size is a problem here ...

one interesting tool to work on this could be Oxipng Oxipng is a multithreaded lossless PNG compression optimizer (rewrite of optipng) https://github.com/shssoichiro/oxipng

or to save even more bytes and go with lossy compression png quant is pretty perfect (especially when pngs contains transparent backgrounds) https://pngquant.org/

going the extra mile: first step use pngquant and after that use oxipng..

xqms commented 2 years ago

Thanks for the nice feedback!

If I understand correctly, you are suggesting to use additional tools as preprocessing steps before compiling the PDF file that is then placed in the cache (and optionally post-processed with ghostscript). I guess that's a really nice idea. We will have to think about a way to do that that is both flexible and portable.

hpvd commented 2 years ago

yes, this is the idea :-)

regarding "external tools" there are really nice once, like the 2 mentioned above for png or mozjpeg for jpeg https://github.com/mozilla/mozjpeg

To have an easy impression what are the problems with jpgs and what is possible with this tool, have a look at this old example https://calendar.perfplanet.com/2014/mozjpeg-3-0/