Python合成gif动图

这里主要用到一个库: imageio

import os
import imageio

fig_path = "path_to_figure/"
all_file = os.listdir(home_path)
all_file.sort()

images = []
for i in all_file:
	file_name = os.path.join(fig_path, i)
    img = imageio.imread(file_name)
    images.append(img)

output_path = "path_to_output/"
imageio.mimsave(output, images, duration=0.15)  # duration 参数为帧间间隔

你可能感兴趣的:(python,开发语言)