; ; lineart5.scm - convert an image into sort of line art ; ; ;;; -------------------------------------------------------------------- ;;; version 0.1 by Jeff Trefftzs ;;; - Initial relase ;;; version 0.2 Raymond Ostertag ;;; - ported to Gimp 2.0, changed menu entry ;;; ;;; -------------------------------------------------------------------- ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Helper function to create a new layer ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (copylayer layer layername) (set! new (car(gimp-layer-copy layer 1))) ; Add an alpha channel (gimp-drawable-set-name new layername) new ) ; Define the function: (define (script-fu-lineart5 inImage inLayer) (let* ( (edgelayer1 (copylayer inLayer "Edge Layer 1")) (edgelayer2 (copylayer inLayer "Edge Layer 2")) (satlayer (copylayer inLayer "Saturation Layer")) (colorlayer (copylayer inLayer "Color Layer")) ) (gimp-image-undo-group-start inImage) ;; Real work goes in here (gimp-image-add-layer inImage edgelayer1 -1) (gimp-image-add-layer inImage edgelayer2 -1) (gimp-drawable-set-visible edgelayer1 TRUE) (gimp-drawable-set-visible edgelayer2 TRUE) (gimp-image-set-active-layer inImage edgelayer2) (gimp-layer-set-mode edgelayer2 15) ; Divide mode (plug-in-gauss-iir 1 inImage edgelayer2 5 TRUE TRUE) ; Blur 5 pix radius (set! linelayer (car(gimp-image-merge-down inImage edgelayer2 0))) (gimp-desaturate linelayer) ; desaturate it (gimp-threshold linelayer 250 255) (gimp-drawable-set-name linelayer "Edges, mostly") (set! copy3 (car (gimp-layer-copy linelayer TRUE))) (gimp-image-add-layer inImage copy3 -1); (plug-in-gauss-iir 1 inImage copy3 32 TRUE TRUE) ; Blur 32 pix radius (gimp-layer-set-mode copy3 4) ; Set to SCREEN-MODE mode (gimp-drawable-set-name copy3 "Blurred Edges used as SCREEN") (gimp-image-add-layer inImage satlayer -1) ; the saturation layer (gimp-layer-set-mode satlayer 12) ; saturation (gimp-image-add-layer inImage colorlayer -1) (gimp-layer-set-mode colorlayer 13) ; color ) (gimp-image-set-active-layer inImage inLayer) (gimp-image-undo-group-end inImage) (gimp-displays-flush) ) (script-fu-register "script-fu-lineart5" _"/Script-Fu/Line-Art/Jeff's Better Line Art..." "Builds a multiple layer image. From the top: two copies of the original, one set to saturation mode, one set to color mode; then a layer of edges, and, at the bottom, the original itself. This version uses Jeff's synthetic edge detector." "Jeff Trefftzs" "Copyright 2001, Jeff Trefftzs" "March 11 , 2001" "RGB* GRAY* INDEXED*" SF-IMAGE "The Image" 0 SF-DRAWABLE "The Layer" 0 )