How to determine blur radius with Python pillow?

I am trying to blur the image using Pillow using ImageFilter as follows:

from PIL import ImageFilter blurred_image = im.filter(ImageFilter.BLUR) 

This works fine except that it has a dial radius that is too small for me. I want to blur the image so much that it can hardly be recognized. In the docs, I see that the default radius is 2, but I really don't understand how I can set it to a larger value

Does anyone know how I can increase the blur radius with a pillow? All tips are welcome!

+5
source share
1 answer

Image.filter() accepts ImageFilter , so you can create an instance of ImageFilter.GaussianBlur with any radius you want, passed as a named argument.

 blurred_image = im.filter(ImageFilter.GaussianBlur(radius=50)) 

You can even make it more concise:

 blurred_image = im.filter(ImageFilter.GaussianBlur(50)) 
+4
source

All Articles