PIL(PythonImageLibrary)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处理库了。
python中使用pil的方法:
在命令行使用PIP安装:
pipinstallPillow
或在命令行使用easy_install安装:
easy_installPillow
安装完成后,使用fromPILimportImage就引用使用库了。比如:
fromPILimportImage
im=Image.open("bride.jpg")
im.rotate(45).show()
示例:
fromPILimportImage
fromPILimportImageFilter
im=Image.open("beauty.jpg")
om=im.filter(ImageFilter.BLUR)
om.save("beautyBlur.jpg")
以上内容为大家介绍了python中如何使用pil,希望对大家有所帮助,如果想要了解更多Python相关知识,请关注IT培训机构:瀚银百科。