Friday, March 02, 2007

gimp script-fu #2

so now i wanted to add shadows from a script.
like this: gimp -i -b - < shadow3.scm
the final shadow3.scm looks like this: ( WARNING ... this changes "n.png")
(define (simple-shadow filename)
(let*
(
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image)))
)

(set! outshadow (car (script-fu-drop-shadow image drawable 1 1 1 '(0 0 0) 35 FALSE)))

(gimp-image-merge-down image drawable 1)
(set! drawable (car (gimp-image-get-active-layer image)))

(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)
)
)


(simple-shadow "n.png")
(print errobj)
(gimp-quit 0)


;eof
hope that pasting here doesnt mix up any important whitespace.
note the (print errobj) ... that's really useful for debugging
now i only got to write a bash script that iterates over all images, copies them to n.png and back

gimp script-fu

trying to do a bit of batch processing with gimp.
wasn't easy to get started with that.
tried to get script-fu-drop-shadow working from the console first.
this did the trick:
(script-fu-drop-shadow 1 2 8 8 15 '(0 0 0) 80 TRUE)
no RUN-NONINTERACTIVE or anything ...
the 1 is the image id ( it is shown in the info window after the file name)
the 2 is the layer id ( shown in the layer dialog - edit layer attributes after the name)
the console batch script: coming soon