05-26-2022, 10:34 AM
I have tried script for linking a image with its mask but its not working. I need it to be worked urgently. Kindly help.
Code:
(define (script-fu-auto-mask-image Mask InImage OutImage)
(let* (
Image (car (file-tiff-load RUN-NONINTERACTIVE InImage InImage)) ImgW (car (gimp-image-width Image)) ImgH (car (gimp-image-height Image))
PrimeLayer (car (gimp-image-get-active-layer Image))
(gimp-layer-add-alpha PrimeLayer))
(gimp-layer-new Image ImgW ImgH RGB-IMAGE MaskLayer 0 LAYER-MODE-NORMAL)
(gimp-file-load-layer RUN-NONINTERACTIVE Image Mask)
(gimp-image-set-active-layer Image MaskLayer)
(gimp-image-select-color mask CHANNEL-OP-ADD drawable (0 0 0))
(gimp-image-set-active-layer Image PrimeLayer)
;(gimp-edit-clear drawable)
(gimp-drawable-edit-clear drawable)
(gimp-image-remove-layer Image MaskLayer)
(file-png-save-defaults RUN-NONINTERACTIVE Image drawable OutImage OutImage)
)
(gimp-displays-flush)
(gimp-quit TRUE)
)
I am trying to execute it through this command.
gimp -i -c -b '(script-fu-auto-mask-image "Pictures/test/mask.png" "Pictures/test/DSC00805.tif" "test.png")' -b '(gimp-quit 0)