0 votes
in Python Imaging Library by
Can you write a Python script using PIL to apply a filter to an image?

1 Answer

0 votes
by
Yes, using PIL’s ImageFilter module we can apply filters to an image. Here is a simple script that applies the “BLUR” filter:

from PIL import Image, ImageFilter

# Open an image file

img = Image.open('example.jpg')

# Apply blur filter

blurred_img = img.filter(ImageFilter.BLUR)

# Save the new image

blurred_img.save('blurred_example.jpg')
...