??有时候绘制了一系列迭代图,最直观的展示方法是将其制作为 gif 图,代码为:
import imageio
filenames = []
for i in range(100):
filename = 'Generation '+str(i+1)+'.png'
print(filename)
filenames.append(filename)
img_paths = filenames
gif_images = []
nums=1
for path in img_paths:
gif_images.append(imageio.imread(path))
print(nums)
nums=nums+1
imageio.mimsave("test.gif",gif_images,fps=5)
原文:https://www.cnblogs.com/yznnnn/p/10629799.html