Skip to content

Improved handling of RGBA palettes when saving GIF images#8366

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:gif_rgba
Sep 10, 2024
Merged

Improved handling of RGBA palettes when saving GIF images#8366
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:gif_rgba

Conversation

@radarhere
Copy link
Copy Markdown
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.

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