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

Alpha Channel Removal Issue When All Values Are 255 #419

Open
linkillhz opened this issue Jul 29, 2024 · 1 comment
Open

Alpha Channel Removal Issue When All Values Are 255 #419

linkillhz opened this issue Jul 29, 2024 · 1 comment

Comments

@linkillhz
Copy link

Hello,

I've encountered an issue with pngquant where the alpha channel is removed when all alpha values in the original image are 255 (completely opaque). After optimization, the output file no longer contains the alpha channel.

Issue Description

When I run pngquant on an image where every pixel's alpha value is 255, the resulting file seems to have the alpha channel completely removed. This behavior is unexpected because I would prefer to retain the alpha channel even if it is fully opaque.

Steps to Reproduce

Prepare a PNG image where every pixel's alpha value is 255.
pngquant --force --output optimized.png original.png
Check the resulting optimized.png file.

Actual Behavior

The alpha channel is removed, and the resulting image does not have an alpha channel.

Question

Is this the intended behavior when all alpha values are 255?
If so, is there a way to force pngquant to retain the alpha channel in the output file even when all alpha values are completely opaque?

Thank you for your assistance.

@kornelski
Copy link
Owner

In the PNG8 format there is no such thing as an alpha channel.

It's a palette based image. If all pixels have alpha 255, then there's no reason to create palette with other alpha values, and they wouldn't be used anyway.

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

No branches or pull requests

2 participants