I am trying to create and save a GIF from a set of PNG files.
pics=[]
for plot_path in plot_paths:
img = Image.open(plot_path)
pics.append(img)
pics[0].save(save_dir+'/truestrain.gif', format='gif', save_all=True, append_images=pics[1:], duration=10, loop=0)
The output is a gif file, of the correct name, but only using the first PNG file, and 10 seconds long.
save_all=True
should prompt it to use all of the images in append_images=pics[1:]
, but that doesn't seem to be working.
duration=10
should set the duration between frames as 10ms, seems to be interpreted as total time 10s (contrary to the Pillow documentation?)
I have seen a relevant previous post, which agrees with the method I am using, but still having problems (Saving an animated GIF in Pillow). I've also checked this follows the documentation (https://pillow.readthedocs.io/en/3.1.x/handbook/image-file-formats.html).