12. ImageFilter Find Edges
12.1. Find Edges
Use the
Image.filter(ImageFilter.FIND_EDGES)
method to find the edges of parts of the image.Best results require an image in RGB mode rather than RGBA.
from PIL import Image, ImageFilter
with Image.open("test_images/alph_blocks.png") as im:
im_rgb = im.convert(mode='RGB')
new_im = im_rgb.filter(ImageFilter.FIND_EDGES)
new_im.save("filters/find_edges.png")