X-Git-Url: http://git.tomasm.cz/imago.git/blobdiff_plain/f0d17e971a75a2d4d86b64877d6de51da3fad2a9..890c6fc05c289fa41d3db2f17037f3b7428151fb:/filters.py diff --git a/filters.py b/filters.py index c2648ea..825834f 100644 --- a/filters.py +++ b/filters.py @@ -1,6 +1,9 @@ -from PIL import Image +from PIL import Image, ImageFilter def edge_detection(image): + image = image.filter(ImageFilter.GaussianBlur()) + # GaussianBlur is undocumented class, it might not work in future versions + # of PIL image_l = image.load() new_image = Image.new('L', image.size) new_image_l = new_image.load() @@ -11,7 +14,7 @@ def edge_detection(image): image_l[a, b] for b in range(y - 2, y + 3)]) for a in range(x - 2, x + 3)]) - - (25 * image_l[x, y])) + - (25 * image_l[x, y])) if pix > 255: pix = 255 if pix < 0: