You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using same images and a list of durations to produce a gif
What did you expect to happen?
produce the gif the specified durations
What actually happened?
failed when saving
What are your OS, Python and Pillow versions?
OS: win10
Python: 3.6
Pillow: 6.1.0
to reproduce, add following testcase to Tests/test_file_gif.py, then run pytest Tests/test_file_gif.py
deftest_totally_identical_frames(self):
duration_list= [1000, 1500, 2000, 4000]
out=self.tempfile("temp.gif")
image_path="Tests/images/bc7-argb-8bpp_MipMaps-1.png"im_list= [
Image.open(image_path),
Image.open(image_path),
Image.open(image_path),
Image.open(image_path),
]
mask=Image.new("RGBA", im_list[0].size, (255, 255, 255, 0))
frames= []
forimageinim_list:
frames.append(Image.alpha_composite(mask, image))
# duration as listframes[0].save(out,
save_all=True, append_images=frames[1:], optimize=False, duration=duration_list, loop=0,
transparency=0)
reread=Image.open(out)
# Assert that the first three frames were combinedself.assertEqual(reread.n_frames, 1)
# Assert that the new duration is the total of the identical framesself.assertEqual(reread.info["duration"], 8500)
err info is:
if "duration" in im.encoderinfo:
duration = int(im.encoderinfo["duration"] / 10)
TypeError: unsupported operand type(s) for /: 'list' and 'int'
What did you do?
Using same images and a list of durations to produce a gif
What did you expect to happen?
produce the gif the specified durations
What actually happened?
failed when saving
What are your OS, Python and Pillow versions?
to reproduce, add following testcase to
Tests/test_file_gif.py
, then runpytest Tests/test_file_gif.py
err info is:
Pillow/src/PIL/GifImagePlugin.py
Lines 473 to 477 in f3f45cf
seems like we should copy duration info from
im_frames[0]
toim
whenlen(im_frames) == 1
The text was updated successfully, but these errors were encountered: