Popular Posts

Saturday, April 9, 2011

High Contrast Color Effect: Photo effect using the Gimp.

High Contrast Color Effect:

This will turn a photo into a High Contrast Color effect:

Here is the code -->
;*************************************************************************************** 
;High Contrast Color for GIMP 2.x
;*************************************************************************************** 
(define (script-fu-HighContrastColor
        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)))
            (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)))
            (save-color (car (gimp-context-get-foreground)))
        )
        (gimp-image-add-layer img TEMP1 -1)
        (plug-in-despeckle RUN-NONINTERACTIVE img TEMP1 (* width .003) 1 -1 256)
        (plug-in-dog RUN-NONINTERACTIVE img TEMP1 (* height .002 7.5) (* width .002 .3) TRUE TRUE)
        (gimp-threshold TEMP1 246 255)
        (gimp-image-add-layer img2 TONES -1)
        (gimp-image-convert-grayscale img2)
        (gimp-image-convert-indexed img2 NO-DITHER MAKE-PALETTE 4 FALSE FALSE "0")
        (gimp-edit-copy TONES)
        (gimp-image-add-layer img TEMP3 +1)
        (gimp-floating-sel-anchor (car (gimp-edit-paste TEMP3 0)))
        (gimp-layer-set-mode TEMP1 OVERLAY-MODE)
        (gimp-image-merge-down img TEMP1 0)
        (gimp-image-add-layer img TEMP2 -1)
        (gimp-layer-set-mode TEMP2 COLOR-MODE)
        (gimp-image-merge-down img TEMP2 0)
        (gimp-context-set-foreground '(0 0 0))
        (gimp-image-add-layer img TEMP0 -1)
        (gimp-by-color-select TEMP0 '(0 0 0) 20 0 2 0 0 0)
        (gimp-drawable-fill TEMP0 WHITE-FILL)
        (if (= (car (gimp-selection-is-empty img)) FALSE)
            (gimp-bucket-fill TEMP0 FG-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
        )
        (gimp-context-set-foreground save-color)
        (gimp-selection-clear img)
        (gimp-layer-set-mode TEMP0 MULTIPLY-MODE)
        (gimp-image-merge-down img TEMP0 0)

        (set! TEMP1 (car (gimp-image-get-active-layer img)))
        (gimp-layer-set-name TEMP1 "HighContrastColor")
        (gimp-image-delete img2)
        (gimp-undo-push-group-end img)
        (gimp-displays-flush)
    )
)
(script-fu-register
 "script-fu-HighContrastColor"
 _"<Image>/Script-Fu/Artistic/HighContrastColor"
 "Creates a High Contrast Color Effect."
 ""
 ""
 ""
 "RGB*"
 SF-IMAGE    "Image"        0
 SF-DRAWABLE    "Drawable"    0
)

High Contrast Color

No comments:

Post a Comment