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
        img
        drawable
    )
    (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)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-BW-Comic"
 _"<Image>/Script-Fu/Artistic/BW-Comic"
 "Creates a BW-Comic Effect."
 ""
 ""
 "2011"
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

Sunday, April 10, 2011

CarTOONize Effect: Photo effect using the Gimp.

CarTOONize Effect:

This will CarTOONize a Photo:  Options to change line size, halftone etc...

Here is the code -->
;*************************************************************************************** 
; CarToonize Image script for GIMP 2.x
; Version 1.0.1 - 17-12-2010 added halftone option, check for existence of GREYCstoration
;             pop up message only. Filter continues if non-existent. 
;             Added G'MIC support as per forum request.
; Version 1.0.2 - 17-12-2010 Re-did the Half-tone the same as the comic strip effect
;             Copyright (C) 2010 John Harris john@grynn.com> 
;             Based on comic-book script by Joe Kitella <joe.kitella@gmail.com
; Version 1.0.3 - 17-12-2010 Revised Halftone effect again... Coding problem with layers. 
; Version 1.0.4 - 20-12-2010 Added last resort pre-filter of Selective Gaussian Blur as per
;             forum request (Rob A>), tightened up the parameters from the request at 
;             5/15 to 4/11. There was too much edge loss at the higher values.
; Version 1.0.5 - 21-12-2010 Added SF-OPTION to select the default smoothing type if all filters
;             are installed. (Defaults to none installed). 
; Version 1.0.6 - 22-12-2010 Added Despeckle smoothing option, ... to display name, and did all edit-
;             copy-pastes to a named buffer. Cleaned up code, removed a section that was
;             no longer being used. Generates better skin-tone colors than before.
;             24-12-2010 Added Despeckle to filter register information. Changed levels for truer colors.
; Version 1.0.7 - 31-12-2010 Added Level of colors to either flatten out the colors, or make more levels.
;             Fixed the active layer display issue when not using halftone. Added option to
;             keep image on existing layer (non haltone). Default is keep. Gimp 2.7 fixes.
; ---------------------------------------------------------------------------------------
(define (script-fu-CarTOONize
        img
        drawable
        Prefilter
        filter-type
        line-size
        enable-shadow
        shadow-intensity
        cdepth
        new-layer
        half-tone
    )

    (gimp-image-undo-group-start img)

    (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (old-selection (car (gimp-selection-save img)))
            (image-type (car (gimp-image-base-type img)))
            (buffer (car (gimp-edit-named-copy drawable "temp-buffer")))
            (toon-img (car (gimp-edit-named-paste-as-new buffer)))
            (layer-temp1 (car (gimp-layer-new toon-img width height 0 "temp1" 100 NORMAL-MODE)))
            (layer-temp2 (car (gimp-layer-new toon-img width height 0 "temp2" 100 NORMAL-MODE)))
            (layer-temp3 (car (gimp-layer-new toon-img width height 0 "temp3" 100 NORMAL-MODE)))
            (layer-temp2a (car (gimp-layer-new toon-img width height 0 "temp2a" 100 NORMAL-MODE)))
            (layer-temp4 (car (gimp-layer-new toon-img width height 0 "temp4" 100 NORMAL-MODE)))
            (layer-temp5 (car (gimp-layer-new toon-img width height 0 "temp5" 100 NORMAL-MODE)))
            (layer-temp6 (car (gimp-layer-new toon-img width height 0 "temp6" 100 NORMAL-MODE)))
            (layer-temp7 (car (gimp-layer-new toon-img width height 0 "temp7" 100 NORMAL-MODE)))
            (layer-gmic (car (gimp-layer-new toon-img width height 0 "gmic" 100 NORMAL-MODE)))
            (layer-cartoonize (car (gimp-layer-new img width height 0 "CarTOONize" 100 NORMAL-MODE)))
            (layer-comic (car (gimp-layer-new img width height 0 "Comic-strip" 100 NORMAL-MODE)))
            (cdepth (* 4 cdepth)) 
            (isfiltered FALSE)
        ) 
        (gimp-image-undo-disable toon-img)
        (if (eqv? (car (gimp-selection-is-empty toon-img)) TRUE)
            (gimp-drawable-fill old-selection WHITE-IMAGE-FILL)) 
        (gimp-image-add-layer toon-img layer-gmic -1)
        (gimp-image-add-layer toon-img layer-temp7 -1) 
        (gimp-image-add-layer toon-img layer-temp6 -1) 
        (gimp-image-add-layer toon-img layer-temp5 -1)
        (gimp-image-add-layer toon-img layer-temp4 -1)
        (gimp-image-add-layer toon-img layer-temp3 -1)
        (if (= enable-shadow TRUE)
            (begin
                (gimp-image-add-layer toon-img layer-temp2a -1)
                (gimp-layer-set-mode layer-temp2a 3)
            )
        )
        (gimp-image-add-layer toon-img layer-temp1 -1)
        (gimp-image-add-layer toon-img layer-temp2 -1)
        (gimp-levels-stretch drawable)
        (set! buffer (car (gimp-edit-named-copy drawable "temp-buffer")))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-gmic buffer 0)))
        (if (= Prefilter TRUE)
            (if (= filter-type 2)
                (if (defined? 'plug-in-greycstoration)
                    (begin
                        (plug-in-greycstoration 1 toon-img layer-gmic 60 .70 1 .6 1.1 .8 30 2 0 0 4 10 15 7 1 2)
                        (set! isfiltered TRUE)
                    )
                    (gimp-message "GREYCstoration must be installed to prefilter, no filter will be applied.")
 
                )
            ) 
        ) 
        (if (= Prefilter TRUE)
            (if (= filter-type 3)
                (if (= isfiltered FALSE)
                    (if (defined? 'plug-in-gmic)
                        (begin
                            (plug-in-gmic 1 toon-img layer-gmic 1 "-gimp_anisotropic_smoothing 60,.7,1,1.1,1,1,30,2,0,1,1,1,1")
                            (set! isfiltered TRUE)
                        )
                        (gimp-message "G'MIC must be installed to prefilter, no filter will be applied.")
                    ) 
                )
            )
        )
        (if (= Prefilter TRUE)
            (if (= filter-type 0)
                (if (= isfiltered FALSE)
                    (if (defined? 'plug-in-sel-gauss)
                        (plug-in-sel-gauss 1 toon-img layer-gmic 4 11)
                    )
                )
            ) 
        )
        (if (= Prefilter TRUE)
            (if (= filter-type 1)
                (if (= isfiltered FALSE)
                    (if (defined? 'plug-in-despeckle)
                        (plug-in-despeckle 1 toon-img layer-gmic 7 1 -1 256)
                    )
                )
            ) 
        )
        (set! buffer (car (gimp-edit-named-copy (car (gimp-image-get-active-layer toon-img)) "temp-buffer")))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp1 buffer 0)))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp3 buffer 0)))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp4 buffer 0)))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp7 buffer 0)))
        (if (= enable-shadow TRUE)
            (begin
                (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp2a buffer 0)))
                (gimp-desaturate-full layer-temp2a 2)
                (gimp-threshold layer-temp2a shadow-intensity 255)
            )
        )
        (gimp-layer-set-mode layer-temp3 15)
        (gimp-layer-set-mode layer-temp5 15)
        (gimp-layer-set-mode layer-temp4 3)
        (gimp-layer-set-mode layer-temp6 3)
        (gimp-layer-set-mode layer-temp2 16)
        (gimp-desaturate-full layer-temp3 2)
        (set! buffer (car (gimp-edit-named-copy layer-temp1 "temp-buffer")))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp2 buffer 0)))
        (plug-in-gauss 1 toon-img layer-temp2 (/ (* height line-size 0.01 ) 6) (/ (* height line-size 0.01 ) 6) 1)
        (gimp-invert layer-temp2)
        (gimp-image-merge-down toon-img layer-temp2 0)
        (set! layer-temp1 (car (gimp-image-get-active-layer toon-img)))
        (gimp-threshold layer-temp1 245 255)
        (gimp-layer-set-mode layer-temp1 3)
        (gimp-image-merge-down toon-img layer-temp3 0)
        (set! layer-temp4 (car (gimp-image-get-active-layer toon-img)))
        (set! buffer (car (gimp-edit-named-copy layer-temp4 "temp-buffer")))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp5 buffer 0)))
        (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-temp6 buffer 0)))
        (gimp-desaturate-full layer-temp5 2)
        (gimp-image-merge-down toon-img layer-temp5 0)
        (set! layer-temp4 (car (gimp-image-get-active-layer toon-img)))
        (gimp-layer-set-mode layer-temp4 3)
        (gimp-image-raise-layer toon-img layer-temp4)
        (gimp-image-merge-down toon-img layer-temp4 0)
        (set! layer-temp6 (car (gimp-image-get-active-layer toon-img)))
        (gimp-layer-set-mode layer-temp6 14)
        (gimp-image-merge-down toon-img layer-temp6 0)
        (set! layer-temp7 (car (gimp-image-get-active-layer toon-img)))
        (gimp-levels layer-temp7 0 0 255 1 0 225)
        (gimp-image-flatten toon-img)
        (gimp-image-convert-indexed toon-img 0 0 cdepth 0 0 "")
        (gimp-image-convert-rgb toon-img)
        (set! layer-temp1 (car (gimp-image-get-active-layer toon-img)))
        (set! buffer (car (gimp-edit-named-copy (car (gimp-image-get-active-drawable toon-img)) "temp-buffer" )))
        (if (= new-layer TRUE)
            (begin
                (gimp-image-add-layer img layer-cartoonize -1)
                (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-cartoonize buffer 0 )))
                (gimp-image-set-active-layer img layer-cartoonize)
            )
            (gimp-floating-sel-anchor (car (gimp-edit-named-paste drawable buffer 0 )))
        )
        (if (= half-tone TRUE)
            (begin
                (gimp-image-add-layer img layer-comic -1)
                (gimp-floating-sel-anchor (car (gimp-edit-named-paste layer-comic buffer 0)))
                (plug-in-unsharp-mask 0 0 layer-comic 4 10 0)
                (plug-in-newsprint 0 0 layer-comic 1 .3 4 1 0 15 0 75 0 0 0 6)
            )
        )
        (gimp-displays-flush)
        (gimp-image-undo-group-end img)
    )
)

(script-fu-register
 "script-fu-CarTOONize"
 _"<Image>/Filters/Artistic/CarTOONize..."
 "Toon a Picture. Take a standard RGB or Grayscale picture, and cartoonize it. You can adjust the thickness of the lines, as well as adjust the 'black' shadow intensity. Now you can adjust the color depth, 1 is the flattest, 5 has the most levels. Prefilter option requires and uses either the GREYCstoration Filter, the newer G'MIC Filter, Despeckle or the Selective Gaussian Blur. Set it to FALSE if you don't want noise reduction. Now have the option to keep it on existing layer (non haltone). Is Gimp 2.7 ready."
 ""
 ""
 "2010, December"
 "RGB* GRAY*"
 SF-IMAGE    "Image"                0
 SF-DRAWABLE    "Drawable"            0
 SF-TOGGLE    _"Prefilter (Noise reduction)"    TRUE
 SF-OPTION    _"Filter type (Noise Reduction)" '("Selective Gaussian Blur Smoothing" "Despeckle Smoothing" "GREYCStoration Smoothing" "G'MIC Anistropic Smoothing")
 SF-ADJUSTMENT    _"Line Thickness (pixels)"    '(10 2 30 1 10 0 1)
 SF-TOGGLE    _"Black Shadows"        TRUE
 SF-ADJUSTMENT    _"Shadow Intensity"        '(35 0 50 1 10 0 1)
 SF-ADJUSTMENT    _"Color Levels"            '(4 1 5 1 10 0 1)
 SF-TOGGLE    _"Generate as new layer"    FALSE
 SF-TOGGLE    _"Halftone"            FALSE
)
CarTOONize Halftoned

CarTOONize Defaults

Toon Effect: Photo effect using the Gimp.

Toon Effect:

This will turn a photo into a Toon effect:

Here is the code -->
;*************************************************************************************** 
; Toon Image script for GIMP 2.2
; --------------------------------------------------------------------

(define (script-fu-Toon
        img
        drawable
    )

    (gimp-undo-push-group-start img)
    (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (layer51 (car (gimp-layer-new-from-drawable drawable img)))
            (layer50 (car (gimp-layer-new-from-drawable drawable img)))
            (layerp0 (car (gimp-layer-new-from-drawable drawable img)))
            (layerp1 (car (gimp-layer-new-from-drawable drawable img)))
            (layerbl (car (gimp-layer-new-from-drawable drawable img)))
        )
        (gimp-image-add-layer img layer51 -1)
 
        (let*    (
                (image-type (car (gimp-image-base-type img)))
                (smoothness 8)
                (fidelity 5)
                (colors 16)
                (blur (/ (* width smoothness 0.001 ) fidelity))
                (count 0)
                (layer-lock (car (gimp-layer-get-lock-alpha layer51)))
                (layer-type (car (gimp-drawable-type layer51)))
                (layer-temp1 (car (gimp-layer-new img width height layer-type "temp1" 100 NORMAL-MODE)))
                (img2 (car (gimp-image-new width height image-type)))
                (layer-temp2 (car (gimp-layer-new img2 width height layer-type "temp2" 100 NORMAL-MODE)))
            )
            (gimp-drawable-fill layer-temp1 TRANS-IMAGE-FILL)
            (gimp-image-add-layer img layer-temp1 -1)
            (gimp-edit-copy layer51)
            (gimp-floating-sel-anchor (car (gimp-edit-paste layer-temp1 0)))
            (gimp-layer-set-lock-alpha layer-temp1 TRUE)
            (while (< count fidelity)
                (plug-in-gauss 1 img layer-temp1 blur blur 0)
                (set! count (+ count 1))
            )
            (gimp-layer-set-lock-alpha layer-temp1 layer-lock)
            (gimp-levels layer-temp1 0 0 182 1.0 0 255)
            (gimp-edit-copy layer-temp1)
            (gimp-image-add-layer img2 layer-temp2 -1)
            (gimp-drawable-fill layer-temp2 TRANS-IMAGE-FILL)
            (gimp-floating-sel-anchor (car (gimp-edit-paste layer-temp2 0)))
            (gimp-image-convert-indexed img2 0 0 colors 0 0 "0")
            (gimp-edit-copy layer-temp2)
            (gimp-image-delete img2)
            (gimp-layer-add-alpha layer-temp1)
            (gimp-floating-sel-anchor (car (gimp-edit-paste layer-temp1 0)))
        )
        (gimp-image-add-layer img layerp0 -1)
        (gimp-image-add-layer img layerp1 -1)
        (plug-in-gauss 1 img layerp1 7.0 7.0 1)
        (gimp-layer-set-opacity layerp1 50.0)
        (gimp-invert layerp1)
        (gimp-image-merge-down img layerp1 0)
        (set! layerp0 (car (gimp-image-get-active-layer img)))
        (gimp-levels layerp0 0 100 155 1.00 0 255)
        (gimp-desaturate-full layerp0 1)
        (gimp-levels layerp0 0 39 128 .77 0 255)
        (gimp-levels layerp0 0 184 205 .32 0 255)
        (gimp-layer-set-mode layerp0 17)
        (gimp-image-add-layer img layer50 -1)
        (plug-in-normalize 1 img layer50)
        (gimp-threshold layer50 128 255)
        (gimp-layer-set-opacity layer50 40.0)
        (gimp-layer-set-mode layer50 17)
        (gimp-image-merge-down img layerp0 0)
        (set! drawable (car (gimp-image-get-active-layer img)))
        (gimp-image-merge-down img drawable 0)
        (gimp-image-merge-down img layer50 0)
        (set! drawable (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name drawable "Toon")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-Toon" _"<Image>/Script-Fu/Artistic/Toon"
 "Toon a Picture"
 ""
 ""
 "2011"
 "RGB* GRAY*"
 SF-IMAGE "Image"    0
 SF-DRAWABLE "Drawable" 0
)
Toon 

Polarizing Filter Effect: Using the GIMP

Polarizing Filter Effect:
Polarized

Original 


This will add a digital polarizing filter effect:

Here is the code -->

;*************************************************************************************** 
; Polarize script for GIMP 2.x
; --------------------------------------------------------------------
(define (script-fu-polarize
        img
        drawable
    )
    (gimp-undo-push-group-start img)
    (let*    (
            (new-img (car (plug-in-decompose 1 img drawable "Red" 1)))
            (new-layer (car (gimp-image-get-active-layer new-img)))
             (TEMP0 (car (gimp-layer-copy drawable FALSE)))
             (TEMP1 (car (gimp-layer-copy drawable FALSE)))
        )
        (gimp-image-add-layer img TEMP1 -1)
        (gimp-image-add-layer img TEMP0 -1)
        (gimp-edit-copy new-layer)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP0 0)))
        (gimp-layer-set-mode TEMP0 SOFTLIGHT-MODE)
        (gimp-image-merge-down img TEMP0 EXPAND-AS-NECESSARY)
        (set! TEMP0 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name TEMP0 "Polarize")
        (gimp-image-delete new-img)
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)

    )
)
(script-fu-register
 "script-fu-polarize"
 _"<Image>/Script-Fu/Artistic/Polarize"
 "Creates a Polarize filter Effect."
 ""
 ""
 "2011"
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

Rotoscope Effect: Photo effect using the Gimp.

Rotoscope Effect:
This will turn a photo into a RotoScope effect:

Here is the code -->
;***************************************************************************************
; RotoScope script for GIMP 2.x
;***************************************************************************************
(define (script-fu-RotoScope
        img
        drawable
    )
    (gimp-undo-push-group-start img)
    (if (= (car (gimp-drawable-has-alpha drawable)) TRUE)
        (begin
            (gimp-image-flatten img)
            (set! drawable (car (gimp-image-get-active-layer img)))
        )
    )
    (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (img2 (car (gimp-image-new width height 0)))
            (tones (car (gimp-layer-new-from-drawable drawable img2)))
            (layer0 (car (gimp-layer-new-from-drawable drawable img)))
            (layer1 (car (gimp-layer-new-from-drawable drawable img)))
            (layer2 (car (gimp-layer-new-from-drawable drawable img)))
            (layer3 (car (gimp-layer-new-from-drawable drawable img)))
            (layer4 (car (gimp-layer-new-from-drawable drawable img)))
            (save-color (car (gimp-context-get-foreground)))
        )
        (gimp-image-add-layer img2 tones -1)
        (gimp-image-add-layer img layer4 -1)
        (gimp-image-add-layer img layer3 -1)
        (plug-in-despeckle RUN-NONINTERACTIVE img layer3 (* width .003) 1 -1 256)
        (plug-in-dog RUN-NONINTERACTIVE img layer3 (* height .002 7.5) (* width .002 .3) TRUE TRUE)
        (gimp-threshold layer3 246 255)
        (gimp-layer-set-mode layer3 MULTIPLY-MODE)
        (gimp-image-add-layer img layer2 -1)
        (gimp-image-add-layer img layer1 -1)
        (gimp-layer-set-mode layer1 SATURATION-MODE)
        (gimp-layer-set-mode layer2 COLOR-MODE)
        (gimp-layer-set-opacity layer1 67.0)
        (gimp-layer-set-opacity layer2 76.0)
        (gimp-image-convert-indexed img2 NO-DITHER MAKE-PALETTE 3 FALSE FALSE "0")
        (gimp-edit-copy tones)
        (gimp-floating-sel-anchor (car (gimp-edit-paste layer4 0)))
        (gimp-image-merge-down img layer3 0) ;lines
        (gimp-image-merge-down img layer2 0) ;saturation
        (gimp-image-merge-down img layer1 0) ;color
        (gimp-context-set-foreground '(0 0 0))
        (gimp-image-add-layer img layer0 -1)
        (gimp-by-color-select layer0 '(0 0 0) 10 0 2 0 0 0)
        (gimp-drawable-fill layer0 WHITE-FILL)
        (if (= (car (gimp-selection-is-empty img)) FALSE)
            (gimp-bucket-fill layer0 FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
        )
        (gimp-context-set-foreground save-color)
        (gimp-selection-clear img)
        (gimp-layer-set-mode layer0 MULTIPLY-MODE)
        (gimp-image-merge-down img layer0 0) ;black info.
        (set! layer4 (car (gimp-image-get-active-layer img)))
        (gimp-image-convert-rgb img2)
        (gimp-edit-copy layer4)
        (gimp-floating-sel-anchor (car (gimp-edit-paste tones 0)))
        (gimp-image-convert-indexed img2 NO-DITHER MAKE-PALETTE 32 FALSE FALSE "0")
        (gimp-edit-copy tones)
        (gimp-floating-sel-anchor (car (gimp-edit-paste layer4 0)))
        (gimp-image-delete img2)
        (gimp-layer-set-name layer4 "RotoScope")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)

(script-fu-register
 "script-fu-RotoScope"
 _"<Image>/Script-Fu/Artistic/RotoScope"
 "Creates a RotoScoped Effect."
 ""
 ""
 "2011"
 "RGB* GRAY*"
 SF-IMAGE "Image"     0
 SF-DRAWABLE "Drawable" 0
)


Rotoscope

Vignette Effect: Photo effect using the Gimp.

Vignette Effect:

This will Add a Vignette layer to the Photo:  Option to fade to Black or White

Here is the code -->
;*************************************************************************************** 
; Vignette script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-vignette
        img
        drawable
        black-shadows
    )
    (gimp-undo-push-group-start img)
     (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (startx (/ width 10))
            (starty (/ height 10))
            (color-save (car (gimp-context-get-foreground)))           
            (temp0 (car (gimp-layer-new-from-drawable drawable img)))
            (temp0-mask (car (gimp-layer-create-mask temp0 ADD-WHITE-MASK)))
           
        )
        (gimp-image-add-layer img temp0 -1)
        (gimp-ellipse-select img startx starty (* 0.8 width) (* 0.8 height)  CHANNEL-OP-REPLACE TRUE FALSE 0.0)
        (gimp-layer-add-mask temp0 temp0-mask)
        (gimp-context-set-foreground '(0 0 0))
        (if (= black-shadows TRUE)
            (gimp-drawable-fill temp0 FOREGROUND-FILL))
        (if (= black-shadows FALSE)
            (gimp-drawable-fill temp0 WHITE-FILL))
        (gimp-edit-bucket-fill temp0-mask FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
        (gimp-selection-clear img)
        (gimp-layer-set-mode temp0 HARDLIGHT-MODE)
        (gimp-context-set-foreground color-save)
        (plug-in-gauss RUN-NONINTERACTIVE img temp0-mask (* width .36) (* height .36) 1)
        (gimp-layer-set-opacity temp0 78.0)
        (gimp-layer-set-name temp0 "Vignette")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-vignette"
 _"<Image>/Script-Fu/Artistic/Vignette..."
 "Creates a Vignette Layer."
 ""
 ""
 "2011"
 "RGB* GRAY*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
 SF-TOGGLE    "Fade to Black (Unchecked = Fade to White)"             TRUE
)

Original
Fade to White
Fade To Black

Saturday, April 9, 2011

Pencil Sketch Effect: Photo effect using the Gimp.

Pencil Sketch Effect:

This will turn a photo into a Pencil Sketch effect:

Here is the code -->
;*************************************************************************************** 
; Pencil Sketch script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-PencilSketch
        img
        drawable
    )
    (gimp-undo-push-group-start img)
     (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (temp0 (car (gimp-layer-new-from-drawable drawable img)))
            (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)))
            (startx (/ width 10))
            (starty (/ height 10))
            (color-save (car (gimp-context-get-foreground)))            
            (vtemp0 (car (gimp-layer-new-from-drawable drawable img)))
            (vtemp0-mask (car (gimp-layer-create-mask vtemp0 ADD-WHITE-MASK)))

        )
        (gimp-image-add-layer img temp1 -1)
        (gimp-image-add-layer img temp2 -1)
        (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)))
        (plug-in-cartoon RUN-NONINTERACTIVE img temp1 (* width .013) .20)
        (gimp-desaturate-full temp1 DESATURATE-AVERAGE)
        (gimp-levels temp1 HISTOGRAM-VALUE 0 255 1.0 170 255)
        (plug-in-sel-gauss RUN-NONINTERACTIVE img temp1 (* width .016) 13)
        (gimp-image-add-layer img temp3 -1)
        (gimp-desaturate-full temp3 DESATURATE-AVERAGE)
        (gimp-levels temp3 HISTOGRAM-VALUE 153 169 .16 247 255)
        (gimp-layer-set-mode temp3 MULTIPLY-MODE)
        (plug-in-gauss RUN-NONINTERACTIVE img temp3 (* width .033) (* height .033) 1)
        (gimp-image-merge-down img temp3 0)
        (gimp-image-add-layer img temp0 -1)
        (gimp-desaturate-full temp0 DESATURATE-AVERAGE)
        (gimp-brightness-contrast temp0 91 111)
        (gimp-layer-set-mode temp0 GRAIN-EXTRACT-MODE)
        (gimp-layer-set-opacity temp0 7.1)
        (gimp-image-merge-down img temp0 0)
        (set! temp1 (car (gimp-image-get-active-layer img)))
        (plug-in-gauss RUN-NONINTERACTIVE img temp1 (* width .003) (* height .003) 1)
        (gimp-layer-set-mode temp1 MULTIPLY-MODE)
        (gimp-image-add-layer img temp4 +1)
        (gimp-desaturate-full temp4 DESATURATE-AVERAGE)
        (gimp-image-add-layer img temp5 +1)
        (gimp-desaturate-full temp5 DESATURATE-AVERAGE)
                (gimp-invert temp5)
        (plug-in-gauss 1 img temp5 (* width .09) (* height .09) 0)
        (gimp-layer-set-mode temp5 ADDITION-MODE)
        (gimp-image-merge-down img temp5 0)
        (gimp-image-merge-down img temp1 0)
        (gimp-image-add-layer img vtemp0 -1)
        (gimp-ellipse-select img startx starty (* 0.8 width) (* 0.8 height)  CHANNEL-OP-REPLACE TRUE FALSE 0.0)
        (gimp-layer-add-mask vtemp0 vtemp0-mask)
        (gimp-context-set-foreground '(0 0 0))
        (gimp-drawable-fill vtemp0 WHITE-FILL)
        (gimp-edit-bucket-fill vtemp0-mask FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
        (gimp-selection-clear img)
        (gimp-layer-set-mode vtemp0 HARDLIGHT-MODE)
        (gimp-context-set-foreground color-save)
        (plug-in-gauss RUN-NONINTERACTIVE img vtemp0-mask (* width .36) (* height .36) 1)
        (gimp-layer-set-opacity vtemp0 78.0)
        (gimp-image-merge-down img vtemp0 0)
        (set! temp1 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name temp1 "Pencil Sketch")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-PencilSketch"
 _"<Image>/Script-Fu/Artistic/Pencil Sketch"
 "Creates a Pencil Sketch Effect."
 ""
 ""
 ""
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

Pencil Sketch

Pencil Shade Effect: Photo effect using the Gimp.

Pencil Shade Effect:

This will turn a photo into a Pencil Shade effect:

Here is the code -->
;*************************************************************************************** 
; Pencil Shade script for GIMP 2.x
;***************************************************************************************
(define    (script-fu-pencil-shade
        image
        drawable
    )
    (define (get-matrix matrix-list)
        (define (list-ref l n) (nth n l))
        (let* ((count 0)
            (matrix (cons-array 25 'double)))
            (while (< count 25)
                (aset matrix count (list-ref matrix-list count))
            (set! count (+ count 1)))
            matrix))
    (define matrix-list
        (list    16.0 -1.0 -1.0 -1.0 -1.0
            -1.0 16.0 -1.0 -1.0 -1.0
            -1.0 -1.0 16.0 -1.0 -1.0
            -1.0 -1.0 -1.0 16.0 -1.0
            -1.0 -1.0 -1.0 -1.0 16.0))
    (gimp-undo-push-group-start image)
    (let*    (
            (shadeLayer (car (gimp-layer-new-from-drawable drawable image)))
            (lineLayer (car (gimp-layer-new-from-drawable drawable image)))
            (matrix (get-matrix matrix-list))
            (channels (cons-array 5 'long))
            (aset channels 0 1)
            (aset channels 1 1)
            (aset channels 2 1)
            (aset channels 3 1)
            (aset channels 4 0)
        )
        (gimp-image-add-layer image shadeLayer -1)
        (gimp-image-add-layer image lineLayer -1)
        (gimp-layer-set-mode lineLayer MULTIPLY-MODE)
        (gimp-desaturate lineLayer)
        (gimp-desaturate shadeLayer)
        (plug-in-apply-canvas RUN-NONINTERACTIVE image shadeLayer 2 1)
        (plug-in-dog RUN-NONINTERACTIVE image shadeLayer 35 3 TRUE TRUE)
        (plug-in-convmatrix RUN-NONINTERACTIVE image shadeLayer 25 matrix FALSE 50 0 5 channels 2)
        (plug-in-sharpen RUN-NONINTERACTIVE image shadeLayer 45)
        (plug-in-convmatrix RUN-NONINTERACTIVE image shadeLayer 25 matrix FALSE 50 0 5 channels 2)
        (plug-in-sharpen RUN-NONINTERACTIVE image shadeLayer 85)
        (plug-in-dog RUN-NONINTERACTIVE image lineLayer 3 1 TRUE TRUE)
        (plug-in-unsharp-mask RUN-NONINTERACTIVE image lineLayer 4 4 5)
        (gimp-layer-set-opacity lineLayer 50)
        (gimp-image-merge-down image lineLayer 0)
        (set! shadeLayer (car (gimp-image-get-active-layer image)))
        (gimp-layer-set-name shadeLayer "Pencil-Shade")
        (gimp-undo-push-group-end image)
        (gimp-displays-flush)

    )
)

(script-fu-register
 "script-fu-pencil-shade"
 _"<Image>/Script-Fu/Artistic/Pencil-Shade"
 "Creates a pencil shaded style"
 ""
 ""
 "2011"
 "RGB* GRAY*"
 SF-IMAGE "Image" 0
 SF-DRAWABLE "Drawable" 0
)


Pencil Shade

Pencil Color Effect: Photo effect using the Gimp.

Pencil Color Effect:

This will turn a photo into a Pencil Color effect:

Here is the code -->
;*************************************************************************************** 
; Pencil script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-Pencil-color
        img
        drawable
    )
    (gimp-undo-push-group-start img)
     (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (TEMP0 (car (gimp-layer-new-from-drawable drawable img)))
            (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)
        (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)))
        (plug-in-cartoon RUN-NONINTERACTIVE img TEMP1 (* width .013) .20)
        (gimp-desaturate-full TEMP1 DESATURATE-AVERAGE)
        (gimp-levels TEMP1 HISTOGRAM-VALUE 0 255 1.0 170 255) 
        (plug-in-sel-gauss RUN-NONINTERACTIVE img TEMP1 (* width .016) 13)
        (gimp-image-add-layer img TEMP3 -1)
        (gimp-desaturate-full TEMP3 DESATURATE-AVERAGE)
        (gimp-levels TEMP3 HISTOGRAM-VALUE 153 169 .16 247 255) 
        (gimp-layer-set-mode TEMP3 MULTIPLY-MODE)
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP3 (* width .033) (* height .033) 1)
        (gimp-image-merge-down img TEMP3 0)
        (gimp-image-add-layer img TEMP0 -1)
        (gimp-desaturate-full TEMP0 DESATURATE-AVERAGE)
        (gimp-brightness-contrast TEMP0 91 111)
        (gimp-layer-set-mode TEMP0 GRAIN-EXTRACT-MODE)
        (gimp-layer-set-opacity TEMP0 7.1)
        (gimp-image-merge-down img TEMP0 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP1 (* width .006) (* height .006) 1)
        (gimp-image-add-layer img TEMP4 -1)
        (gimp-image-add-layer img TEMP5 -1)
        (gimp-layer-set-mode TEMP4 COLOR-MODE)
        (gimp-layer-set-opacity TEMP4 28.3)
        (gimp-layer-set-mode TEMP5 SATURATION-MODE)
        (gimp-layer-set-opacity TEMP5 8.7)
        (gimp-image-merge-down img TEMP4 0)
        (gimp-image-merge-down img TEMP5 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name TEMP1 "Pencil-color")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-Pencil-color"
 _"<Image>/Script-Fu/Artistic/Pencil-color"
 "Creates a Color Pencil Sketch Effect."
 ""
 ""
 ""
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)


Pencil Color

Pencil Effect: Photo effect using the Gimp.

Pencil Effect:

This will turn a photo into a Pencil effect:

Here is the code -->
;*************************************************************************************** 
; Pencil script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-Pencil
        img
        drawable
    )
    (gimp-undo-push-group-start img)
     (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (TEMP0 (car (gimp-layer-new-from-drawable drawable img)))
            (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)))
        )
        (gimp-image-add-layer img TEMP1 -1)
        (gimp-image-add-layer img TEMP2 -1)
        (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)))
        (plug-in-cartoon RUN-NONINTERACTIVE img TEMP1 (* width .013) .20)
        (gimp-desaturate-full TEMP1 DESATURATE-AVERAGE)
        (gimp-levels TEMP1 HISTOGRAM-VALUE 0 255 1.0 170 255) 
        (plug-in-sel-gauss RUN-NONINTERACTIVE img TEMP1 (* width .016) 13)
        (gimp-image-add-layer img TEMP3 -1)
        (gimp-desaturate-full TEMP3 DESATURATE-AVERAGE)
        (gimp-levels TEMP3 HISTOGRAM-VALUE 153 169 .16 247 255) 
        (gimp-layer-set-mode TEMP3 MULTIPLY-MODE)
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP3 (* width .033) (* height .033) 1)
        (gimp-image-merge-down img TEMP3 0)
        (gimp-image-add-layer img TEMP0 -1)
        (gimp-desaturate-full TEMP0 DESATURATE-AVERAGE)
        (gimp-brightness-contrast TEMP0 91 111)
        (gimp-layer-set-mode TEMP0 GRAIN-EXTRACT-MODE)
        (gimp-layer-set-opacity TEMP0 7.1)
        (gimp-image-merge-down img TEMP0 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP1 (* width .003) (* height .003) 1)
        (gimp-layer-set-name TEMP1 "Pencil")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-Pencil"
 _"<Image>/Script-Fu/Artistic/Pencil"
 "Creates a Pencil Trace Effect."
 ""
 ""
 ""
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

Pencil

Line Art Effect: Photo effect using the Gimp.

Line Art Effect:

This will turn a photo into a Line Art effect:

Here is the code -->
;*************************************************************************************** 
; Lineart script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-lineart
        img
        drawable
    )
    (gimp-undo-push-group-start img)
     (let*    (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (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)
        (plug-in-despeckle RUN-NONINTERACTIVE img TEMP1 (* width .003) 1 -1 256)
        (plug-in-sel-gauss RUN-NONINTERACTIVE img TEMP1 (* width .003) 13)
        (gimp-edit-copy TEMP1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP2 0)))
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP2 (* width .007) (* height .007) 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-image-add-layer img TEMP4 -1)
        (gimp-layer-set-mode TEMP3 MULTIPLY-MODE)
        (gimp-layer-set-mode TEMP4 MULTIPLY-MODE)
        (gimp-edit-copy TEMP1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP3 0)))
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP4 0)))
        (gimp-image-merge-down img TEMP3 0)
        (gimp-image-merge-down img TEMP4 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-threshold TEMP1 228 255)
        (gimp-image-add-layer img TEMP5 -1)
        (gimp-desaturate-full TEMP5 DESATURATE-AVERAGE)
        (gimp-brightness-contrast TEMP5 83 120)
        (gimp-layer-set-mode TEMP5 MULTIPLY-MODE)
        (gimp-layer-set-opacity TEMP5 40.0)
        (gimp-image-merge-down img TEMP5 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name TEMP1 "Lineart")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-lineart"
 _"<Image>/Script-Fu/Artistic/Lineart"
 "Creates a Line Drawing Fine Line Effect."
 ""
 ""
 ""
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)


Line Art

Ink Toned Effect: Photo effect using the Gimp.

Ink Toned Effect:

This will turn a photo into a Ink Toned effect:

Here is the code -->
;*************************************************************************************** 
; INK-Toned script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-InkToned
        img
        drawable
    )
    (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)))
            (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)))
        ) 
        (gimp-image-add-layer img TEMP1 -1)
        (gimp-image-add-layer img TEMP2 -1)
        (gimp-image-add-layer img2 TONES -1)
        (gimp-desaturate-full TONES 2)
        (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-layer-set-name TEMP1 "Ink-Toned")
        (gimp-image-delete img2)
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-InkToned"
 _"<Image>/Script-Fu/Artistic/InkToned"
 "Creates a Ink Sketch with tones Effect."
 ""
 ""
 "2011"
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

Ink Toned

Ink Pen Effect: Photo effect using the Gimp.

Ink Pen Effect:

This will turn a photo into a Ink Pen effect:

Here is the code -->
;*************************************************************************************** 
; INK-PEN script for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-InkPen
        img
        drawable
    )
    (gimp-undo-push-group-start img)
    (let* (
            (width (car (gimp-drawable-width drawable)))
            (height (car (gimp-drawable-height drawable)))
            (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)))
        ) 
        (gimp-image-add-layer img TEMP1 -1)
        (gimp-image-add-layer img TEMP2 -1)
        (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-layer-set-name TEMP1 "InkPen")
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-InkPen"
 _"<Image>/Script-Fu/Artistic/InkPen"
 "Creates a InkPen Sketch Effect."
 ""
 ""
 "2011"
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)


Ink Pen

High Contrast Effect: Photo effect using the Gimp.

High Contrast Effect:

This will turn a photo into a High Contrast effect:

Here is the code -->
;*************************************************************************************** 
;High Contrast for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-HighContrast
        img
        drawable
    )
    (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)))
            (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)))
            (TEMP6 (car (gimp-layer-new-from-drawable drawable img)))
        )
        (gimp-image-add-layer img TEMP1 -1)
        (gimp-image-add-layer img TEMP2 -1)
        (plug-in-despeckle RUN-NONINTERACTIVE img TEMP1 (* width .003) 1 -1 256)
        (plug-in-sel-gauss RUN-NONINTERACTIVE img TEMP1 (* width .003) 13)
        (gimp-edit-copy TEMP1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP2 0)))
        (plug-in-gauss RUN-NONINTERACTIVE img TEMP2 (* width .007) (* height .007) 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-image-add-layer img TEMP4 -1)
        (gimp-layer-set-mode TEMP3 MULTIPLY-MODE)
        (gimp-layer-set-mode TEMP4 MULTIPLY-MODE)
        (gimp-edit-copy TEMP1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP3 0)))
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP4 0)))
        (gimp-image-merge-down img TEMP3 0)
        (gimp-image-merge-down img TEMP4 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-threshold TEMP1 228 255)
        (gimp-image-add-layer img2 TONES -1)
        (gimp-desaturate-full TONES DESATURATE-LIGHTNESS)
        (gimp-image-convert-indexed img2 NO-DITHER MAKE-PALETTE 4 FALSE FALSE "0")
        (gimp-edit-copy TONES)
        (gimp-image-add-layer img TEMP6 +1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP6 0)))
        (gimp-layer-set-mode TEMP1 OVERLAY-MODE)
        (gimp-image-merge-down img TEMP1 0)
        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name TEMP1 "HighContrast")
        (gimp-undo-push-group-end img)
        (gimp-image-delete img2)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-HighContrast"
 _"<Image>/Script-Fu/Artistic/HighContrast"
 "Creates a Line Drawing Fine Line Effect."
 ""
 ""
 ""
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

High Contrast