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

Set all transparent colors to be equal in quantize() #5282

Merged
merged 1 commit into from Mar 31, 2021

Conversation

@radarhere
Copy link
Member

@radarhere radarhere commented Feb 25, 2021

When quantize() converts an RGBA image to P mode, it currently translates two pixels with full transparency as different if they have different RGB values. This PR sets all transparent pixels to have the same RGB values as the first transparent pixel, so that they all end up with the same P value.

This improvement is also helpful when it comes to GIFs, which can only mark one color in the palette as transparent. This resolves the second part of #3603

@hugovk hugovk merged commit 7275331 into python-pillow:master Mar 31, 2021
49 of 50 checks passed
@radarhere radarhere deleted the quantize branch Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants