Hello,
I am trying to do the simplest of operations, and I'm still stumped after six hours of tutorials. I can't get a simple script.scm to load a file, put it in a layer, add the layer to the active image and call it a day. My ultimate objective is to paste the same .png on top of every picture (about 70 of them) in batch mode. In order to feed the "load this particular file as a layer" command to Batch Image Manipulation plug-in, it has to be a script.
Despite a great deal of time on the internet looking for the proper syntax of gimp-file-load-layer, I could not find a single explanation to the "filename" parameter. Is it an absolute path? If relative, of what and where? If absolute, what's the proper syntax: do I put quotes, slash or backslash, one or two slash after C:? When I try to run my script, I get the error "Execution error for 'Test': Error: ( : 1) Invalid type for argument 2 to gimp-image-insert-layer, which I take to mean what I'm trying to feed it isn't a layer, which means the gimp-load-layer operation failed.
My stupidly simple and obstinately not working "script-fu-test.scm" is as follows:
(define (script-fu-test image drawable)
(let*
(
(position -1)
(back-layer nil)
)
(set! back-layer(gimp-file-load-layer RUN-NONINTERACTIVE image "C:/Test/test.png"))
(gimp-image-insert-layer image back-layer 0 position)
(gimp-displays-flush)
)
)
(script-fu-register "script-fu-test"
"/Filters/Test"
"Try."
"Art Wade"
"Art Wade"
"January 2008"
"RGB*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
I've been banging my head against the wall a while now and I'm pretty frustrated. Any help would be deeply appreciated and met with an effusion of gratitude.
Fixed it.
"Sleep on it", they say. Woke up this morning with a start my mind screaming (CAR())!!!!! Turns out I just have to correct this line
(set! back-layer(car (gimp-file-load-layer RUN-NONINTERACTIVE image "C:/Test/test.png")))
and it works now. Ah, the frustrations of learning a new scripting language. Have a nice day!