Pillow-ImageSequence模块 图像序列处理
发布日期:2021-07-01 05:57:55 浏览次数:3 分类:技术文章

本文共 839 字,大约阅读时间需要 2 分钟。

读取图片序列 seek、tell

from PIL import Imageimage = Image.open('./images/capf.gif')index=1try:    while 1:        image.seek(image.tell()+1)        print('图像读取第'+str(index)+'帧')        image.save('./images/capf_gif/帧'+str(index)+'.png')        index=index+1except EOFError:    print('图像读取完毕!')
图像读取第1帧图像读取第2帧图像读取第3帧图像读取第4帧图像读取第5帧图像读取第6帧图像读取第7帧图像读取第8帧图像读取第9帧图像读取第10帧图像读取第11帧图像读取第12帧图像读取完毕!

迭代器读取 ImageSequence模块

from PIL import ImageSequencefor frame in ImageSequence.Iterator(image):    print(frame.format,frame.size,frame.mode,frame.getbands())
GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)GIF (500, 296) P ('P',)

转载地址:https://pandora.blog.csdn.net/article/details/104085053 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:OSI七层协议
下一篇:Pillow-ImageFilter、ImageEnhance模块 图像增强

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年04月28日 20时43分03秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章