mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Use duration from info dictionary when saving
This commit is contained in:
parent
9dcb1f402c
commit
1d8c5a820c
|
@ -176,3 +176,16 @@ class TestFileWebp:
|
|||
[abs(original_value[i] - reread_value[i]) for i in range(0, 3)]
|
||||
)
|
||||
assert difference < 5
|
||||
|
||||
@skip_unless_feature("webp")
|
||||
@skip_unless_feature("webp_anim")
|
||||
def test_duration(self, tmp_path):
|
||||
with Image.open("Tests/images/dispose_bgnd.gif") as im:
|
||||
assert im.info["duration"] == 1000
|
||||
|
||||
out_webp = str(tmp_path / "temp.webp")
|
||||
im.save(out_webp, save_all=True)
|
||||
|
||||
with Image.open(out_webp) as reloaded:
|
||||
reloaded.load()
|
||||
assert reloaded.info["duration"] == 1000
|
||||
|
|
|
@ -192,7 +192,7 @@ def _save_all(im, fp, filename):
|
|||
r, g, b = palette[background * 3 : (background + 1) * 3]
|
||||
background = (r, g, b, 0)
|
||||
|
||||
duration = im.encoderinfo.get("duration", 0)
|
||||
duration = im.encoderinfo.get("duration", im.info.get("duration"))
|
||||
loop = im.encoderinfo.get("loop", 0)
|
||||
minimize_size = im.encoderinfo.get("minimize_size", False)
|
||||
kmin = im.encoderinfo.get("kmin", None)
|
||||
|
|
Loading…
Reference in New Issue
Block a user