less parameters for manual.lines
[imago.git] / filters.py
index c2648ea..825834f 100644 (file)
@@ -1,6 +1,9 @@
-from PIL import Image
+from PIL import Image, ImageFilter
 
 def edge_detection(image):
 
 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()
     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)])
                 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:
             if pix > 255:
                 pix = 255
             if pix < 0: