mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
Merge pull request #8443 from radarhere/apng_p_transparency
This commit is contained in:
commit
838e0fb1a5
|
@ -258,8 +258,8 @@ def test_apng_mode() -> None:
|
|||
assert im.mode == "P"
|
||||
im.seek(im.n_frames - 1)
|
||||
im = im.convert("RGBA")
|
||||
assert im.getpixel((0, 0)) == (255, 0, 0, 0)
|
||||
assert im.getpixel((64, 32)) == (255, 0, 0, 0)
|
||||
assert im.getpixel((0, 0)) == (0, 255, 0, 255)
|
||||
assert im.getpixel((64, 32)) == (0, 255, 0, 255)
|
||||
|
||||
with Image.open("Tests/images/apng/mode_palette_1bit_alpha.png") as im:
|
||||
assert im.mode == "P"
|
||||
|
|
|
@ -1063,6 +1063,12 @@ class PngImageFile(ImageFile.ImageFile):
|
|||
"RGBA", self.info["transparency"]
|
||||
)
|
||||
else:
|
||||
if self.im.mode == "P" and "transparency" in self.info:
|
||||
t = self.info["transparency"]
|
||||
if isinstance(t, bytes):
|
||||
updated.putpalettealphas(t)
|
||||
elif isinstance(t, int):
|
||||
updated.putpalettealpha(t)
|
||||
mask = updated.convert("RGBA")
|
||||
self._prev_im.paste(updated, self.dispose_extent, mask)
|
||||
self.im = self._prev_im
|
||||
|
|
Loading…
Reference in New Issue
Block a user