Skip to content

Commit a77eb67

Browse files
authored
Merge pull request #6683 from radarhere/apng
2 parents c924fd8 + 46b0644 commit a77eb67

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Tests/test_file_apng.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,18 +553,20 @@ def test_apng_save_disposal(tmp_path):
553553
def test_apng_save_disposal_previous(tmp_path):
554554
test_file = str(tmp_path / "temp.png")
555555
size = (128, 64)
556-
transparent = Image.new("RGBA", size, (0, 0, 0, 0))
556+
blue = Image.new("RGBA", size, (0, 0, 255, 255))
557557
red = Image.new("RGBA", size, (255, 0, 0, 255))
558558
green = Image.new("RGBA", size, (0, 255, 0, 255))
559559

560560
# test OP_NONE
561-
transparent.save(
561+
blue.save(
562562
test_file,
563563
save_all=True,
564564
append_images=[red, green],
565565
disposal=PngImagePlugin.Disposal.OP_PREVIOUS,
566566
)
567567
with Image.open(test_file) as im:
568+
assert im.getpixel((0, 0)) == (0, 0, 255, 255)
569+
568570
im.seek(2)
569571
assert im.getpixel((0, 0)) == (0, 255, 0, 255)
570572
assert im.getpixel((64, 32)) == (0, 255, 0, 255)

src/PIL/PngImagePlugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ def _write_multiple_frames(im, fp, chunk, rawmode, default_image, append_images)
11281128
prev_disposal = Disposal.OP_BACKGROUND
11291129

11301130
if prev_disposal == Disposal.OP_BACKGROUND:
1131-
base_im = previous["im"]
1131+
base_im = previous["im"].copy()
11321132
dispose = Image.core.fill("RGBA", im.size, (0, 0, 0, 0))
11331133
bbox = previous["bbox"]
11341134
if bbox:

0 commit comments

Comments
 (0)