Python PIL | BoxBlur() method
Image.filter() method.
PIL.ImageFilter.BoxBlur() Blurs the image by setting each pixel to the average value of the pixels in a square box extending radius pixels in each direction. Supports float radius of arbitrary size. Uses an optimized implementation which runs in linear time relative to the size of the image for any radius value.
Synatx: PIL.ImageFilter.BoxBlur() Partameters: radius: Size of the box in one direction. Radius 0 does not blur, returns an identical image. Radius 1 takes 1 pixel in each direction, i.e. 9 pixels in total.
Image used:

# Importing Image and ImageFilter module from PIL package from PIL import Image, ImageFilter # creating a image object im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG") # applying the boxblur method im2 = im1.filter(ImageFilter.BoxBlur(0)) im2.show() |
Output:

# Importing Image and ImageFilter module from PIL package from PIL import Image, ImageFilter # creating a image object im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG") # applying the boxblur method im2 = im1.filter(ImageFilter.BoxBlur(2)) im2.show() |
Output:

# Importing Image and ImageFilter module from PIL package from PIL import Image, ImageFilter # creating a image object im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG") # applying the boxblur method im2 = im1.filter(ImageFilter.BoxBlur(8)) im2.show() |
Output:
Recommended Posts:
- class method vs static method in Python
- Python | next() method
- Python | os.dup() method
- Python | set() method
- Python | os.getsid() method
- Python | os.nice() method
- Python | sympy.gcd() method
- Python | sympy.lcm() method
- Python | os.fork() method
- Python | os.kill() method
- Python | range() method
- Python | os.getpgrp() method
- Python | os.pwrite() method
- Python | sympy.crt() method
- Python | os.scandir() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

