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

Improved handling of RGBA palettes when saving GIF images #8366

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

radarhere
Copy link
Member

Resolves #8222

In the issue, two RGBA images are saved together in the GIF format. However, the transparent background is (0, 0, 0, 0) and (0, 0, 0) is also re-used at different opacities within the image. When GifImagePlugin tries to optimise the image by utilising remap_palette() to group multiple colours together, it doesn't consider the A channel, and so an unexpected result occurs, where the colour information for the bottom line of the second image is lost, and then cropped out.

By improving the detection of RGBA palettes, this is fixed.

@radarhere radarhere added the GIF label Sep 10, 2024
@hugovk hugovk merged commit 302b63f into python-pillow:main Sep 10, 2024
47 of 48 checks passed
@radarhere radarhere deleted the gif_rgba branch September 10, 2024 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GIF optimizer acts wrongly with black pixels when disposal=2
2 participants