script-fu copy image and paste as layer into different image
Hello,
I'm trying to write a script to batch proccess a number of files. I want the script to open file a*.png, convert black color to alpha and paste image b*.png on top of a*.png (both are the same size). The script converts black to alpha, but it doesn't paste image.
(define (batch-alpha-paste pattern
pattern2)
;get the file lists
(let* ((filelist (cadr (file-glob pattern 1)))
(filelist2 (cadr (file-glob pattern2 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(filename2 (car filelist2))
(image2 (car (gimp-file-load RUN-NONINTERACTIVE filename2 filename2)))
(draw2 (car (gimp-image-get-active-layer image2)))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
; convert black to alpha
(plug-in-colortoalpha RUN-NONINTERACTIVE image drawable '(0 0 0))
; ------------
; this part doesn't work, I want to copy image2 into image
; ------------
(gimp-selection-all image2)
(gimp-edit-named-copy-visible image2 "dupa")
(gimp-edit-named-paste drawable "dupa" TRUE)
;----------------------------------------------------------
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image)
(gimp-image-delete image2)
)
(set! filelist (cdr filelist)))))
I call the script from shell:
gimp -i -b '(batch-alpha-paste "aa*.png" "bb*.png")' -b '(gimp-quit 0)'
Any help or suggestion how to copy image2 into image ?