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

Add option and functionality to allow for lossy alpha reductions #23

Closed
CounterPillow opened this issue Mar 4, 2016 · 1 comment
Closed
Labels
I-Medium Issues that are breaking core functionality, but have a known workaround T-Feature Requests for a new feature to be added T-Needs Tests

Comments

@CounterPillow
Copy link

Several other PNG optimisers such as zopflipng have the option to perform "lossy" alpha optimisations. Pixels which are fully transparent may still have RGB data associated; the "lossy" part is to discard said RGB data (which means it's perceptually lossless). An advanced form of this is to set the fully transparent pixels to an RGB value that allows easier compression by the block filters and DEFLATE, depending on the visible pixel data in the image.

@shssoichiro
Copy link
Owner

Thanks for the suggestion! I can see the merit in this. I'm on the fence as to whether this should be an option or enabled by default.

It shouldn't be too difficult to implement the advanced form to play well with the block filters and DEFLATE. Something like:
Set RGB value to those of the previous pixel. If no previous pixel, set to the value of the pixel above. If this is the first pixel in the image, set to 0 0 0.

@shssoichiro shssoichiro added T-Feature Requests for a new feature to be added I-Medium Issues that are breaking core functionality, but have a known workaround T-Needs Tests labels Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-Medium Issues that are breaking core functionality, but have a known workaround T-Feature Requests for a new feature to be added T-Needs Tests
Projects
None yet
Development

No branches or pull requests

2 participants