Skip to content

Handle disposing GIF background from outside palette#7515

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:gif
Dec 21, 2023
Merged

Handle disposing GIF background from outside palette#7515
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:gif

Conversation

@radarhere
Copy link
Member

Resolves #7514

When disposing a GIF frame, Pillow doesn't currently consider that a background index might be higher than the current size of the palette. If that happens, the following code

color = tuple(self._frame_palette.palette[color * 3 : color * 3 + 3])

creates an empty tuple, leading to a TypeError when
self.dispose = Image.core.fill(dispose_mode, dispose_size, color)

tries to create an image filled with an empty tuple.

Instead, this PR uses the first palette entry in such a scenario. This is in line with our default if there is no background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants