Popular Posts

Sunday, April 10, 2011

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

No comments:

Post a Comment