from PIL import Image
im = Image.open('Gif1.gif')
filelist = list()
try:
while True:
count = im.tell()
# tell()返回指定帧
filename = 'output' + str(count).zfill(3) + '.png'
# zfill() 方法返回指定长度的字符串,原字符串右对齐,前面填充0。
filelist.append(filename)
im.save(filename)
# 保存
im.seek(count + 1)
# 查找图片指定帧
except EOFError:
# EOFError:没有内建输入, 到达EOF标记
# EOF:End Of File(文件尾部)
print('End0fFile')
本文地址:https://blog.csdn.net/u012336596/article/details/110940674
黄山市民网:https://www.huangshanshimin.com/