xirongxudlut 2020-04-26
1.利用Python制作gif图片(引用第三方库“imageio”,没有的要先安装)
代码(参考链接:https://blog.csdn.net/ZT7524/article/details/88928005)
import imageio def create_gif(image_list, gif_name, duration = 1.0): frames = [] for image_name in image_list: frames.append(imageio.imread(image_name)) imageio.mimsave(gif_name, frames, ‘GIF‘, duration=duration) return def main(): #这里放上自己所需要合成的图片 image_list = [‘tai1.jpg‘, ‘tai2.jpg‘, ‘tai3.jpg‘,‘tai4.jpg‘,‘tai5.jpg‘,‘tai6.jpg‘,‘tai7.jpg‘,‘tai8.jpg‘,‘tai9.jpg‘,‘tai10.jpg‘,‘tai11.jpg‘,‘tai12.jpg‘,‘tai13.jpg‘,‘tai14.jpg‘] gif_name = ‘new.gif‘ duration = 0.1 create_gif(image_list, gif_name, duration) if __name__ == ‘__main__‘: main()
效果图