mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Corrected default combined frame duration
This commit is contained in:
parent
6a2545f628
commit
72ac7d1ce9
BIN
Tests/images/duplicate_frame.gif
Normal file
BIN
Tests/images/duplicate_frame.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
|
@ -791,6 +791,22 @@ def test_roundtrip_info_duration(tmp_path):
|
|||
] == duration_list
|
||||
|
||||
|
||||
def test_roundtrip_info_duration_combined(tmp_path):
|
||||
out = str(tmp_path / "temp.gif")
|
||||
with Image.open("Tests/images/duplicate_frame.gif") as im:
|
||||
assert [frame.info["duration"] for frame in ImageSequence.Iterator(im)] == [
|
||||
1000,
|
||||
1000,
|
||||
1000,
|
||||
]
|
||||
im.save(out, save_all=True)
|
||||
|
||||
with Image.open(out) as reloaded:
|
||||
assert [
|
||||
frame.info["duration"] for frame in ImageSequence.Iterator(reloaded)
|
||||
] == [1000, 2000]
|
||||
|
||||
|
||||
def test_identical_frames(tmp_path):
|
||||
duration_list = [1000, 1500, 2000, 4000]
|
||||
|
||||
|
|
|
@ -618,7 +618,7 @@ def _write_multiple_frames(im, fp, palette):
|
|||
bbox = delta.getbbox()
|
||||
if not bbox:
|
||||
# This frame is identical to the previous frame
|
||||
if duration:
|
||||
if encoderinfo.get("duration"):
|
||||
previous["encoderinfo"]["duration"] += encoderinfo["duration"]
|
||||
continue
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user