2022-06-18

How to use GuassianBlur to blur the inside edges of a quadrangle with PIL?

I am trying to blur just the edges of an image (actually a quadrangle), but my code seems to be blurring the center of the image as well. My code is:

alpha = img_rotated_rgba.split()[-1]
newalpha = numpy.array(alpha.filter(PIL.ImageFilter.GaussianBlur(80)))
newalpha[numpy.array(alpha)==0] = 0
img_rotated_rgba.putalpha(PIL.Image.fromarray(newalpha))

I am assuming the "80" is a radius and not the opacity, so how I can change the opacity?

Thanks!



No comments:

Post a Comment