01-12-2019, 11:08 PM
(This post was last modified: 01-13-2019, 07:12 PM by Skippy.
Edit Reason: typos
)
Hi,
I am trying to write a script which would insert an image as a layer within layers of another image. Here is what I got so far :
I call the script with gimp -i -b '(foobar "picture.jpg")' -b '(gimp-quit 0)'.
However it fails on gimp-image-insert-layer :
I am struggling to understand this, the only results I get are two old threads on GF.c from which the useful replies have been removed…
What's wrong with my script ?
I am trying to write a script which would insert an image as a layer within layers of another image. Here is what I got so far :
Code:
(define (foobar filename)
(let* (
; open image to add
(inputfile (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(picture (car (gimp-image-get-active-layer inputfile)))
; open file to insert image into
(template (car (gimp-file-load RUN-NONINTERACTIVE "template.xcf" "template.xcf")))
)
; add picture to template
(gimp-image-insert-layer template picture 0 -1)
; flatten image
(gimp-image-flatten template)
; couldn't get this line to work outside the next one, probably have to investigate "let" syntax
; (drawable (car (gimp-image-get-active-drawable template)))
(file-jpeg-save RUN-NONINTERACTIVE template (car (gimp-image-get-active-drawable template)) "outfile.jpg" "outfile.jpg" 0.95 0.95 1 1 "" 2 1 0 2)
)
)
I call the script with gimp -i -b '(foobar "picture.jpg")' -b '(gimp-quit 0)'.
However it fails on gimp-image-insert-layer :
Quote:GIMP-Error: Calling error for procedure 'gimp-image-insert-layer':
Item 'Background' (2) has already been added to an image
batch command experienced an execution error:
Error: ( : 1) Procedure execution of gimp-image-insert-layer failed on invalid input arguments: Item 'Background' (2) has already been added to an image
I am struggling to understand this, the only results I get are two old threads on GF.c from which the useful replies have been removed…
What's wrong with my script ?