Friday, March 07, 2008

Hello Gimp!

Been using gimp for a few months now and it really irks me that gimp does not have the action capabilities of photoshop.... well I was wrong. It does have that action capability... BUT you have to write the script for it. No shortcut like in either photoshop or firewords where you just save from history. Eniways.... heres a script that will place "photographed by h20water" at the bottom right corner of images. ^_^ Save the code as some_filename.scm and drop it into gimp's scripts folder.


; An example script that writes a fixed string in the current
; image.
(define (script-fu-stamp-h20water img drawable)

(define text-float)

(let* (
(y_start (- (car(gimp-drawable-height drawable)) 11) )
(x_start (- (car(gimp-drawable-width drawable)) 120) )
(img_h (car(gimp-drawable-height drawable)) )
(img_w (car(gimp-drawable-width drawable)) )
(watermark (car (gimp-layer-new img
img_w img_h 0
"Watermarked" 100 0)))
)

;work with "watermarked" layer
(gimp-layer-add-alpha watermark)
(gimp-drawable-fill watermark 3)
(gimp-image-add-layer img watermark -1)

;set to b & w
(gimp-context-set-default-colors)


; Create the text. See the Procedure Browser for parameters of gimp-text.
(set! text-float (car (gimp-text-fontname img watermark
x_start y_start "photographed by h20water" 0 1 8 0
"Sans")))

; Anchor the selection
(gimp-floating-sel-anchor text-float)
)

; Flush output
(gimp-displays-flush)

)

(script-fu-register "script-fu-stamp-h20water"
"stamp h20water"
"stamp photographed by h20water in the current image"
"H20water "
"H20water"
"2008-03-07"
"RGB*, GRAY*"
SF-IMAGE "Input Image" 0
SF-DRAWABLE "Input Drawable" 0)
(script-fu-menu-register "script-fu-stamp-h20water"
"/Xtns/Haya")





No comments: