Popular Posts

Saturday, April 9, 2011

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

No comments:

Post a Comment