mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-27 01:00:33 +03:00
If previous disposal was 2, do not fill identical pixels
This commit is contained in:
parent
6782a07b8e
commit
e6a521130e
|
@ -647,6 +647,9 @@ def test_dispose2_palette(tmp_path: Path) -> None:
|
||||||
# Center remains red every frame
|
# Center remains red every frame
|
||||||
assert rgb_img.getpixel((50, 50)) == circle
|
assert rgb_img.getpixel((50, 50)) == circle
|
||||||
|
|
||||||
|
# Check that frame transparency wasn't added unnecessarily
|
||||||
|
assert img._frame_transparency is None
|
||||||
|
|
||||||
|
|
||||||
def test_dispose2_diff(tmp_path: Path) -> None:
|
def test_dispose2_diff(tmp_path: Path) -> None:
|
||||||
out = str(tmp_path / "temp.gif")
|
out = str(tmp_path / "temp.gif")
|
||||||
|
|
|
@ -638,7 +638,11 @@ def _write_multiple_frames(im, fp, palette):
|
||||||
background_im = Image.new("P", im_frame.size, background)
|
background_im = Image.new("P", im_frame.size, background)
|
||||||
background_im.putpalette(im_frames[0]["im"].palette)
|
background_im.putpalette(im_frames[0]["im"].palette)
|
||||||
delta, bbox = _getbbox(background_im, im_frame)
|
delta, bbox = _getbbox(background_im, im_frame)
|
||||||
if encoderinfo.get("optimize") and im_frame.mode != "1":
|
if (
|
||||||
|
encoderinfo.get("optimize")
|
||||||
|
and im_frames[-1]["encoderinfo"].get("disposal") != 2
|
||||||
|
and im_frame.mode != "1"
|
||||||
|
):
|
||||||
if "transparency" not in encoderinfo:
|
if "transparency" not in encoderinfo:
|
||||||
try:
|
try:
|
||||||
encoderinfo["transparency"] = (
|
encoderinfo["transparency"] = (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user