Open 0ion9 opened 9 years ago
optipng can take too much time and resource, imo. My tests here on 300ppi A4 are not really good ; it takes 2 to 4 min of heavy computing with all core of a icore7 2.4GHZ to get 17% compression as a result. Check with the hi-res source page of Pepper&Carrot. I host GB of it, http://www.peppercarrot.com/en/static6/sources
.. That's why I say 'optional'. Whether it is useful depends a lot on what type (and to some extent, also what -amount-) of output you have. For something that is rendered in a very painterly style like Pepper and Carrot, it's completely unsurprising that you didn't get much of an improvement.
The idea of the generic handler was also to enable that kind of special treatment -- do optimize files for X project, don't optimize them for Y project; Never optimize GIFs.. etc. Any kind of custom rule for optimization that we wouldn't want to hardcode into artscript.
+1 for optional then ( and sorry, I missed this while reading your first post ). ( Note : 'trimage image compressor' might already have many good setting to copy for jpg and png. )
I did some test on the issue a while ago as I needed smaller outputs. I needed more time to properly implement it and so I left it in a experimental branch.
Some images generated by artscript are up to 100% (ie 2x) larger than they need to be. Try installing optipng and running it on the output from artscript.
If the image is greyscale, or can be expressed in <= 256 colors, the result is much smaller. The most common reason why is that artscript seems to always create an rgb+alpha output PNG, regardless of whether the input image had an alpha channel or was grayscale. Naturally that needlessly wastes space.
Obviously, some care needs to be taken by the user, in order to not strip important metadata, but IMO optimizing the output file is a step that fits into the task that Artscript is designed to do.
Hopefully, can be done in a generic way (so we can specify one command that handles png and gif.. and whatever other format might be optimizable.)
May be (vaguely) related to #76