[Gimp-user] Q: Batch script adding alpha mask problem
- From: spiderman <forums gimpusers com>
- To: gimp-user-list gnome org
- Cc: team gimpusers com
- Subject: [Gimp-user] Q: Batch script adding alpha mask problem
- Date: Mon, 05 Aug 2013 21:16:15 +0200
(define (script-fu-batch-alpha-add globalpha globpics)
(let* ((filelist (cadr (file-glob globpics 1)))
(filealpha (car(cadr (file-glob globalpha 1))))
(imgalpha (car (gimp-file-load RUN-NONINTERACTIVE
filealpha filealpha)))
(drawablealpha (car (gimp-image-get-active-layer imgalpha)))
)
(gimp-selection-all imgalpha) ;copy my static alpha image
(gimp-edit-copy drawablealpha) ; to buffer and reuse it with every image
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image)))
(mask (car (gimp-layer-create-mask drawable 2)))
) ; add an alpha channel layer mask
(gimp-image-undo-disable image)
(gimp-layer-add-mask drawable mask)
(gimp-layer-set-edit-mask drawable 1)
(gimp-layer-set-show-mask drawable 0)
(gimp-layer-set-apply-mask drawable 1)
(gimp-edit-paste drawable 1) ; paste static alpha image to layer mask
(WHICH IS NOT WORKING in BATCH )
(file-png-save-defaults RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist))))
)
; register
(script-fu-register "script-fu-batch-alpha-add" ............
--
spiderman (via www.gimpusers.com/forums)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]