pip install imageio
import imageio
# 需要合在一起的图片
image_list = [r'C:UsersHlzyDesktop\' + str(x) + ".jpg" for x in range(1, 12)]
# gif的图片名
gif_name = r'C:UsersHlzyDesktop est_gif.gif'
frames = []
for image_name in image_list:
frames.append(imageio.imread(image_name))
# druation : 图片切换的时间,单位秒
imageio.mimsave(gif_name, frames, 'GIF', duration=0.3)