Popular Posts

Saturday, April 9, 2011

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

No comments:

Post a Comment