mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Merge pull request #4742 from radarhere/apng_dispose
Fixed loading non-RGBA mode APNGs with dispose background
This commit is contained in:
commit
645f7f2346
BIN
Tests/images/apng/dispose_op_background_p_mode.png
Normal file
BIN
Tests/images/apng/dispose_op_background_p_mode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -104,6 +104,13 @@ def test_apng_dispose_region():
|
|||
assert im.getpixel((64, 32)) == (0, 255, 0, 255)
|
||||
|
||||
|
||||
def test_apng_dispose_op_background_p_mode():
|
||||
with Image.open("Tests/images/apng/dispose_op_background_p_mode.png") as im:
|
||||
im.seek(1)
|
||||
im.load()
|
||||
assert im.size == (128, 64)
|
||||
|
||||
|
||||
def test_apng_blend():
|
||||
with Image.open("Tests/images/apng/blend_op_source_solid.png") as im:
|
||||
im.seek(im.n_frames - 1)
|
||||
|
|
|
@ -904,7 +904,7 @@ class PngImageFile(ImageFile.ImageFile):
|
|||
dispose = self._prev_im.copy()
|
||||
dispose = self._crop(dispose, self.dispose_extent)
|
||||
elif self.dispose_op == APNG_DISPOSE_OP_BACKGROUND:
|
||||
dispose = Image.core.fill("RGBA", self.size, (0, 0, 0, 0))
|
||||
dispose = Image.core.fill(self.im.mode, self.size)
|
||||
dispose = self._crop(dispose, self.dispose_extent)
|
||||
else:
|
||||
dispose = None
|
||||
|
|
Loading…
Reference in New Issue
Block a user