/ Published in: Lisp
Make an image look like a movie
Expand |
Embed | Plain Text
; ; cine-photo (2009) ; ; Adriano P. (prado@gmx.net) ; ; Create a cinematic effect ; ;Duplicate layer (define (my-duplicate-layer image layer) (let* ( (dup-layer (car (gimp-layer-copy layer 1))) ) (gimp-image-add-layer image dup-layer 0) dup-layer )) (define (script-fu-cine-photo inImage inLayer inCopy) (let* ( (theDrawable 0) (theImage 0) (theLayer 0) (theWidth 0) (theHeight 0) (theBorder 50) ) ;;START UNDO (gimp-image-undo-group-start inImage) (gimp-selection-all inImage) ;Duplicate image (set! theImage (if (= inCopy TRUE) (car (gimp-image-duplicate inImage)) inImage) ) (set! theLayer (car (gimp-image-flatten theImage))) (set! theWidth (car (gimp-image-width theImage))) (set! theHeight (car (gimp-image-height theImage))) (set! theDrawable (car (gimp-image-get-active-drawable theImage))) (gimp-hue-saturation theDrawable 0 0 0 -18) (gimp-curves-spline theDrawable 0 8 #(0 0 55 27 176 197 255 255)) ;Duplicate layer (set! theLayer (my-duplicate-layer theImage theLayer)) (plug-in-gauss-rle RUN-NONINTERACTIVE theImage theLayer 5 TRUE TRUE) ;Add layer mask (let ( (shadow-mask (car (gimp-layer-create-mask theLayer ADD-WHITE-MASK))) ) (gimp-layer-add-mask theLayer shadow-mask) ) ;Create new brush (let ( (brushTemp (car (gimp-brush-new "Temp Brush"))) (i 0) (xx (- theWidth (* 2 theBorder))) (yy (- theHeight (* 2 theBorder))) (mLayer (car (gimp-layer-new theImage theWidth theHeight RGBA-IMAGE "Black" 100 0))) ) (gimp-brush-set-shape brushTemp BRUSH-GENERATED-CIRCLE) (gimp-brush-set-hardness brushTemp 0) (gimp-brush-set-radius brushTemp (/ theWidth 1.6)) (gimp-brush-set-spacing brushTemp 20) (gimp-brush-set-spikes brushTemp 2) (gimp-brush-set-aspect-ratio brushTemp 1) (gimp-brush-set-angle brushTemp 0) (gimp-context-set-brush brushTemp) (gimp-context-set-paint-mode NORMAL-MODE) (set! theDrawable (car (gimp-image-get-active-drawable theImage))) ;Apply the brush (set! i 0) (while (< i 4) (set! i (+ i 1)) (gimp-ellipse-select theImage (+ (rand (* i 10)) (/ theWidth 2)) (+ (rand (* i 10)) (/ theHeight 2)) 1 1 REPLACE 0 0 0) (gimp-edit-stroke theDrawable) ) (gimp-image-add-layer theImage mLayer 0) (gimp-context-set-foreground '(0 0 0)) (gimp-selection-all theImage) (gimp-edit-bucket-fill mLayer FG-BUCKET-FILL NORMAL-MODE 45 15 0 0 0) (gimp-selection-none theImage) ;Add layer mask (let ( (shadow-mask (car (gimp-layer-create-mask mLayer ADD-WHITE-MASK))) ) (gimp-layer-add-mask mLayer shadow-mask) ) (set! theDrawable (car (gimp-image-get-active-drawable theImage))) ;Apply the brush (set! i 0) (while (< i 20) (set! i (+ i 1)) (gimp-ellipse-select theImage (+ theBorder (rand xx)) (+ theBorder (rand yy)) 1 1 REPLACE 0 0 0) (gimp-edit-stroke theDrawable) ) ) ;end of let (set! theLayer (car (gimp-image-flatten theImage))) (if (= inCopy TRUE) (begin (gimp-image-clean-all theImage) (gimp-display-new theImage) ) ) (gimp-selection-none inImage) ;;END UNDO (gimp-image-undo-group-end inImage) (gimp-displays-flush theImage) )) (script-fu-register "script-fu-cine-photo" _"_Cine Photo..." _"Adds a cinematic effect" "Adriano Prado" "2009" "2009-11-03" "RGB* GRAY*" SF-IMAGE "The image" 0 SF-DRAWABLE "The layer" 0 SF-TOGGLE _"Work on copy" TRUE ) (script-fu-menu-register "script-fu-cine-photo" "<Image>/Filters/Decor")
You need to login to post a comment.
