from PIL import Image, ImageSequence
# 1.读取gif
im = Image.open("mao.gif")
# 2。拆分
chai = ImageSequence.Iterator(im)
index = 1
for i in chai:
i.save("image/img%d.png"%index)
print("正在拆分第%d张"%index)
index += 1
imgs = [i.copy() for i in ImageSequence.Iterator(im)]
print(imgs)
# 3。倒序
imgs.reverse()
# 4。拼装倒存
imgs[0].save("reverse.gif",save_all = True, append_images=imgs[1:])
···