当前位置: 首页 > 图灵资讯 > 行业资讯> python中如何使用pil

python中如何使用pil

来源:图灵python
时间: 2026-05-14 16:02:59

PIL(Python Image Library)它是python的第三方图像处理库,但由于其功能强大,用户数量众多,几乎被认为是python的官方图像处理库。

python中使用pil的方法:

PIP安装用于命令行:

pipinstallPillow

或在命令行中使用easy_install安装:

easy_installPillow

安装完成后,使用from PIL import Image引用使用库。例如:

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视频教程栏目,了解更多Python知识。