mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Prefer global transparency for disposal method 2
This commit is contained in:
parent
2d7c487cf8
commit
174b4893f3
BIN
Tests/images/dispose_bgnd_transparency.gif
Normal file
BIN
Tests/images/dispose_bgnd_transparency.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
|
@ -337,6 +337,13 @@ def test_dispose_background():
|
|||
pass
|
||||
|
||||
|
||||
def test_dispose_background_transparency():
|
||||
with Image.open("Tests/images/dispose_bgnd_transparency.gif") as img:
|
||||
img.seek(2)
|
||||
px = img.convert("RGBA").load()
|
||||
assert px[35, 30][3] == 0
|
||||
|
||||
|
||||
def test_transparent_dispose():
|
||||
expected_colors = [(2, 1, 2), (0, 1, 0), (2, 1, 2)]
|
||||
with Image.open("Tests/images/transparent_dispose.gif") as img:
|
||||
|
|
|
@ -271,11 +271,9 @@ class GifImageFile(ImageFile.ImageFile):
|
|||
Image._decompression_bomb_check(dispose_size)
|
||||
|
||||
# by convention, attempt to use transparency first
|
||||
color = (
|
||||
frame_transparency
|
||||
if frame_transparency is not None
|
||||
else self.info.get("background", 0)
|
||||
)
|
||||
color = self.info.get("transparency", frame_transparency)
|
||||
if color is None:
|
||||
color = self.info.get("background", 0)
|
||||
self.dispose = Image.core.fill("P", dispose_size, color)
|
||||
else:
|
||||
# replace with previous contents
|
||||
|
|
Loading…
Reference in New Issue
Block a user