Skip to content

Commit

Permalink
Create disposal image at the destination size, instead of cropping
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Mar 14, 2021
1 parent 16dbffc commit 98ce084
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/PIL/GifImagePlugin.py
Expand Up @@ -265,12 +265,13 @@ def _seek(self, frame):
self.dispose = None
elif self.disposal_method == 2:
# replace with background colour
Image._decompression_bomb_check(self.size)
self.dispose = Image.core.fill("P", self.size, self.info["background"])
x0, y0, x1, y1 = self.dispose_extent
dispose_size = (x1 - x0, y1 - y0)

# only dispose the extent in this frame
if self.dispose:
self.dispose = self._crop(self.dispose, self.dispose_extent)
Image._decompression_bomb_check(dispose_size)
self.dispose = Image.core.fill(
"P", dispose_size, self.info["background"]
)
else:
# replace with previous contents
if self.im:
Expand Down

0 comments on commit 98ce084

Please sign in to comment.