Use transparency behind first GIF frame and when disposing to background by radarhere · Pull Request #5557 · python-pillow/Pillow

Resolves #5548

The issue provides a single frame GIF with a dispose_extent of (0, 0, 27, 32) - which is not the full size of the image.

The spec states that

The Background Color is the color used for those pixels on the screen that are not covered by an image.

However, other software shows this area as transparent instead. This PR is where I give in to this apparently universal convention.

I created the test image here with Pillow.

Credit to df10a72 for the start of this code - although that commit falls back to the background color if there is no transparency. I don't find that behaviour from other software, so I've not included it here.