pip install --upgrade pillow -i http://pypi.douban.com/simple
python -c "import PIL; print(PIL.VERSION, '\t', PIL.PILLOW_VERSION)"
// 1.1.7 3.4.2
利用 Pillow 可以先读取图片文件并判断该图片是否为动态图片及其帧数:
from PIL import Imagewith Image.open('ani.gif') as im:
print(im.is_animated, im.n_frames)
im.save(out, save_all=True, append_images=[im1, im2, ...])
from PIL import Image, ImageSequence
with Image.open('ani.gif') as im:
if im.is_animated:
frames = [f.copy() for f in ImageSequence.Iterator(im)]
frames.reverse() # 内置列表倒序方法
# 将倒序后的所有帧图像保存下来
frames[0].save('out.gif', save_all=True, append_images=frames[1:])
import random # frames.reverse() random.shuffle(frames)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有