import imageio
import os
def create_gif(image_list, gif_name):
frames = []
for image_name in image_list:
frames.append(imageio.imread(image_name))
imageio.mimsave(gif_name, frames, ‘GIF’, duration = 0.5)
return
def find_all_png(path):
png_filenames = [os.path.join(path, i) for i in os.listdir(path)]
buf=[]
for png_file in png_filenames:
buf.append(png_file)
return buf
if name == ‘main’:
for i in range(928):
buff = find_all_png(path=‘img/’+str(i))
create_gif(buff,‘gif/’+’%03d’%i+’.gif’ )