PIL, or the Python Imaging Library is an image processing library in Python. This library supports a wide range of file formats, is designed for an efficient internal representation of image data, and provides powerful image processing capabilities.
ImageFilter module in
PIL contains definitions for a pre-defined set of filters that are used for different purposes.
BoxBlur filter function sets each pixel to the average value of the pixels in a square box. It extends the radius pixels in each direction to blur the image.
radius: This is the size of the box in one direction. A zero radius does not blur the image.
from PIL import Image, ImageFilter import matplotlib.pyplot as plt img = Image.open("man.png") img_blur = img.filter(ImageFilter.BoxBlur(4)) img_blur.save("man_blur.png")
man.pngis read into memory using
BoxBlurfilter with the radius
4to the image we load in Line 3.
View all Courses