9951 explained code solutions for 126 technologies


python-pillowHow to blur an image


from PIL import Image, ImageFilter

im = Image.open('/var/www/examples/heroine.png')
im = im.filter(ImageFilter.BoxBlur(10))

im.show()ctrl + c
PIL

import Pillow package modules

Image.open

open given image with Pillow

/var/www/examples/heroine.png

path to sample image to open

.filter(

add specified filter to an image

ImageFilter.BoxBlur

blur type we use

10

blur radius (strength of blur, the larger the more blurry image we get)

.show()

displays resulting image