Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional optimization command to run after image is generated #83

Open
0ion9 opened this issue Jul 2, 2015 · 4 comments
Open

Optional optimization command to run after image is generated #83

0ion9 opened this issue Jul 2, 2015 · 4 comments

Comments

@0ion9
Copy link

0ion9 commented Jul 2, 2015

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

@Deevad
Copy link
Contributor

Deevad commented Jul 2, 2015

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

@0ion9
Copy link
Author

0ion9 commented Jul 2, 2015

.. 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.

@Deevad
Copy link
Contributor

Deevad commented Jul 2, 2015

+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. )

@vanyossi
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants