Popular Posts

Sunday, April 17, 2011

BW Comic Effect: Photo effect using the Gimp.

BW Comic Effect:

This will Create a B&W Comic From a Photo: 

Here is the code --> ;*************************************************************************************** 
; BW-COMIC script for GIMP 2.x
(define (script-fu-BW-Comic
    (gimp-undo-push-group-start img)
    (let* (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (img2 (car (gimp-image-new width height 0)))
            (img3 (car (gimp-image-new width height 0)))
            (BW (car (gimp-layer-new-from-drawable drawable img3)))
            (TONES (car (gimp-layer-new-from-drawable drawable img2)))
            (TEMP1 (car (gimp-layer-new-from-drawable drawable img)))
            (TEMP2 (car (gimp-layer-new-from-drawable drawable img)))
            (TEMP3 (car (gimp-layer-new-from-drawable drawable img)))
            (TEMP4 (car (gimp-layer-new-from-drawable drawable img)))
            (TEMP5 (car (gimp-layer-new-from-drawable drawable img)))
        (gimp-image-add-layer img TEMP1 -1)
        (gimp-image-add-layer img TEMP2 -1)
        (gimp-image-add-layer img2 TONES -1)
        (gimp-image-add-layer img3 BW -1)
        (gimp-desaturate-full TONES 2)
        (gimp-image-convert-indexed img3 NO-DITHER MONO-PALETTE 2 FALSE FALSE "0")
        (plug-in-sel-gauss RUN-NONINTERACTIVE img TEMP1 (* width .005) 13)
        (gimp-edit-copy TEMP1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP2 0)))
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP2 (* width .013) (* height .013) 1)
        (gimp-layer-set-mode TEMP2 DIVIDE-MODE)
        (gimp-image-merge-down img TEMP2 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-desaturate-full TEMP1 DESATURATE-AVERAGE)
        (gimp-image-add-layer img TEMP3 -1)
        (gimp-edit-copy TEMP1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP3 0)))
        (gimp-threshold TEMP3 246 255)
        (plug-in-cartoon RUN-NONINTERACTIVE img TEMP3 (* width .007) .20)
        (gimp-layer-set-mode TEMP3 MULTIPLY-MODE)
        (gimp-levels TEMP1 HISTOGRAM-VALUE 234 255 10 0 255) 
        (gimp-image-merge-down img TEMP3 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-threshold TEMP1 128 255)
        (gimp-image-convert-indexed img2 NO-DITHER MAKE-PALETTE 4 FALSE FALSE "0")
        (gimp-edit-copy TONES)
        (gimp-image-add-layer img TEMP4 -1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP4 0)))
        (gimp-levels TEMP4 HISTOGRAM-VALUE 0 255 1.0 0 217) 
        (gimp-layer-set-mode TEMP4 GRAIN-MERGE-MODE)
        (gimp-image-merge-down img TEMP4 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-image-add-layer img TEMP5 +1)
        (gimp-layer-set-mode TEMP1 GRAIN-MERGE-MODE)
        (gimp-edit-copy BW)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP5 0)))
        (gimp-image-merge-down img TEMP1 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name TEMP1 "BW-Comic")
        (gimp-image-delete img2)
        (gimp-image-delete img3)
        (gimp-undo-push-group-end img)
 "Creates a BW-Comic Effect."
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0


  1. Where can I find a tutorial that will instruct me on HOW TO APPLY the code???

  2. 1. copy/paste the script starting with ;BW

    and the last 2 lines are
    SF-DRAWABLE "Drawable" 0

    paste into new text file search for something that says it's name like..


    name the file CarTOONize.scm

    save it into

    This is my full location, yours will match the gimp\share\gimp\2.0\scripts
    go to
    /filters/script-fu 'refresh scripts' now with an image open go to
    'filters/artistic/cartoon' for the carTOONize.scm and

    'script-fu/artistic/BW-Comic' for this filter

    this filter runs without any parameters, nice job Joe1GK!