mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Treat previous contents of first frame as transparent
This commit is contained in:
parent
2f5687f886
commit
a47072bcbe
BIN
Tests/images/dispose_prev_first_frame.gif
Normal file
BIN
Tests/images/dispose_prev_first_frame.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 530 B |
BIN
Tests/images/dispose_prev_first_frame_seeked.gif
Normal file
BIN
Tests/images/dispose_prev_first_frame_seeked.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
|
@ -341,6 +341,14 @@ def test_dispose_previous():
|
|||
pass
|
||||
|
||||
|
||||
def test_dispose_previous_first_frame():
|
||||
with Image.open("Tests/images/dispose_prev_first_frame.gif") as im:
|
||||
im.seek(1)
|
||||
assert_image_equal_tofile(
|
||||
im, "Tests/images/dispose_prev_first_frame_seeked.gif"
|
||||
)
|
||||
|
||||
|
||||
def test_previous_frame_loaded():
|
||||
with Image.open("Tests/images/dispose_none.gif") as img:
|
||||
img.load()
|
||||
|
|
|
@ -277,6 +277,14 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
if self.im:
|
||||
# only dispose the extent in this frame
|
||||
self.dispose = self._crop(self.im, self.dispose_extent)
|
||||
elif frame_transparency is not None:
|
||||
x0, y0, x1, y1 = self.dispose_extent
|
||||
dispose_size = (x1 - x0, y1 - y0)
|
||||
|
||||
Image._decompression_bomb_check(dispose_size)
|
||||
self.dispose = Image.core.fill(
|
||||
"P", dispose_size, frame_transparency
|
||||
)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user