PIL是Python Imaging Library,它為python解釋器提供了圖像編輯函數。 ImageFilter模塊包含一組預定義的濾鏡的定義,可以與Image.filter()方法一起使用。
PIL.ImageFilter.GaussianBlur()
方法創建高斯模糊濾鏡。
用法: PIL.ImageFilter.GaussianBlur(radius=5)
參數:
radius-模糊半徑。通過改變半徑的值,得到不同強度的高斯模糊圖像。
返回類型: 一個圖像。
使用的圖片:
# Importing Image and ImageFilter module from PIL package
from PIL import Image, ImageFilter
# creating a image object
im1 = Image.open(r"C:\Users\System-Pc\Desktop\leave.JPG")
# applying the Gaussian Blur filter
im2 = im1.filter(ImageFilter.GaussianBlur(radius = 5))
im2.show()
輸出:
radius:這裏使用的半徑值為2。
Importing Image and ImageFilter module from PIL package
from PIL import Image, ImageFilter
# creating a image object
im1 = Image.open(r"C:\Users\System-Pc\Desktop\leave.JPG")
# applying the Gaussian Blur filter
im2 = im1.filter(ImageFilter.GaussianBlur(radius = 2))
im2.show()
輸出:
相關用法
- Python set()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python next()用法及代碼示例
- Python os.urandom()用法及代碼示例
- Python os.lseek()用法及代碼示例
- Python Tensorflow abs()用法及代碼示例
- Python os.chflags()用法及代碼示例
- Python os.renames()用法及代碼示例
- Python Tensorflow log()用法及代碼示例
- Python Tensorflow exp()用法及代碼示例
- Python sympy.gcd()用法及代碼示例
- Python os.lchown()用法及代碼示例
- Python sympy.lcm()用法及代碼示例
- Python sympy.S()用法及代碼示例
注:本文由純淨天空篩選整理自Sunitamamgai大神的英文原創作品 Python PIL | GaussianBlur() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。