Popular Posts

Saturday, April 9, 2011

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

1 comment:

  1. I'm new to this. I tried copying the script but there is no "paste" option in win 7 in the Gimp 2 scripts folder. How do I install this?
    Thanks,
    Don

    ReplyDelete