Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gimp-image-insert-layer: Item 'Background' (2) has already been added to an image
#4
Thanks, I got it working with gimp-layer-new-from-drawable :


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")))
; duplicate picture into template as new layer
    (layer (car (gimp-layer-new-from-drawable picture template)))
   )
; add picture to template
   (gimp-image-insert-layer template layer 0 -1)
; flatten image
   (gimp-image-flatten 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'll probably go for python later, but I didn't understood whether I had to install pygimp or pgimp or something and rather to investigate I figured it was a good opportunity to give a try to Lisp/Scheme.

PS : Ofnuts, I think you were actually (already) the good Samaritan in the two mentioned threads… Wink
Reply


Messages In This Thread
RE: gimp-image-insert-layer: Item 'Background' (2) has already been added to an image - by Skippy - 01-13-2019, 07:08 PM

Forum Jump: