RSS/Atom feed Twitter
Site is read-only, email is disabled

script-fu copy image and paste as layer into different image

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

script-fu copy image and paste as layer into different image gumaster 18 Mar 10:10
  script-fu copy image and paste as layer into different image floditbob2 25 Apr 13:01
2011-03-18 10:10:04 UTC (over 13 years ago)
postings
1

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 ?

2011-04-25 13:01:25 UTC (over 13 years ago)
postings
1

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. ...
...
; ------------
; 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) ...
...
Any help or suggestion how to copy image2 into image ?

I think "dupa" is still floating when you save your file, try to anchor it: (let ((floating-sel (car (gimp-edit-named-paste drawable "dupa" TRUE)))) (gimp-floating-sel-anchor floating-sel) )