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培訓機構:千鋒教育。