;; Outline effect - shows only edges ;; @param thickness int [1, 10] default 2 ;; @param threshold int [20, 300] default 100 ;; @param color list default (0 0 0) ;; @param fill_mode string default "original" (define-effect outline ((thickness 2) (threshold 100) (color (list 0 0 0)) (fill_mode "original")) (let* ((edge-img (edges frame (/ threshold 2) threshold)) (dilated (if (> thickness 1) (dilate edge-img thickness) edge-img)) (base (cond ((= fill_mode "original") (copy frame)) ((= fill_mode "white") (make-image (width frame) (height frame) (list 255 255 255))) (else (make-image (width frame) (height frame) (list 0 0 0)))))) (map-pixels base (lambda (x y c) (let ((edge-val (luminance (pixel dilated x y)))) (if (> edge-val 128) color c))))))