一、PIL概述
PIL库支持图像存储、显示和处理,它能够处理几乎所有图片格式,可以完成对图像的缩放、剪裁、叠加以及向图像添加线条、图像和文字等操作。
二、微实例
1、GIF图像逐帧提取
from PIL import Image
im = Image.open('timg.gif')
try:
im.save('timg{:02d}.png'.format(im.tell()))
while True:
im.seek(im.tell()+1)
im.save('timg{:02d}.png'.format(im.tell()))
except:
print('End of processing')
"""
image.open(filename) 根据参数加载图像文件
Image.save(filename,format) 将图像保存为filename文件名,format是图片格式
image.seek(frame) 跳转并返回图像中的指定帧
image.tell() 返回当前帧的序号
"""
2、制作图片缩略图
from PIL import