PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处理库了。
python中使用pil的方法:
在命令行使用PIP安装:
pip install Pillow
www#gaodaima.com来源gaodaimacom搞#^代%!码&网搞代码
或在命令行使用easy_install安装:
easy_install Pillow
安装完成后,使用from PIL import Image就引用使用库了。比如:
from PIL import Image im = Image.open("bride.jpg") im.rotate(45).show()
示例:
from PIL import Image from PIL import ImageFilter im = Image.open("beauty.jpg") om = im.filter(ImageFilter.BLUR) om.save("beautyBlur.jpg")
更多Python知识请关注云海天Python教程栏目。
来源:搞代码网:原文地址:https://www.gaodaima.com