Replace with transparency if available for disposal method 2

This commit is contained in:
Andrew Murray 2021-06-26 00:55:31 +10:00
parent f6d504c8f6
commit e29a7d8a94

View File

@ -269,9 +269,14 @@ class GifImageFile(ImageFile.ImageFile):
dispose_size = (x1 - x0, y1 - y0)
Image._decompression_bomb_check(dispose_size)
self.dispose = Image.core.fill(
"P", dispose_size, self.info.get("background", 0)
# by convention, attempt to use transparency first
color = (
frame_transparency
if frame_transparency is not None
else self.info.get("background", 0)
)
self.dispose = Image.core.fill("P", dispose_size, color)
else:
# replace with previous contents
if self.im: