Improved handling of RGBA palettes when saving GIF images by radarhere · Pull Request #8366 · python-pillow/Pillow

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.