Draw first frame on top of transparency

This commit is contained in:
Andrew Murray 2021-06-25 21:54:21 +10:00
parent 70ef50cf72
commit 5b4cb5052a
3 changed files with 12 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B

View File

@ -298,6 +298,12 @@ def test_eoferror():
im.seek(n_frames - 1)
def test_first_frame_transparency():
with Image.open("Tests/images/first_frame_transparency.gif") as im:
px = im.load()
assert px[0, 0] == im.info["transparency"]
def test_dispose_none():
with Image.open("Tests/images/dispose_none.gif") as img:
try:

View File

@ -317,6 +317,12 @@ class GifImageFile(ImageFile.ImageFile):
if self.palette:
self.mode = "P"
def load_prepare(self):
if not self.im and "transparency" in self.info:
self.im = Image.core.fill(self.mode, self.size, self.info["transparency"])
super(GifImageFile, self).load_prepare()
def tell(self):
return self.__frame