Other

Gimp-drawable-is-layer-mask doesn't recognize layer as mask

Gimp-drawable-is-layer-mask doesn't recognize layer as mask

Postby clhaag » Thu Oct 29, 2009 3:33 pm

I need to open a PSD image, write out the layers and get information about the masks. Am having problems recognizing a layer mask.

I've created a simple PSD image with one layer that has a layer mask. I can write out the layer and the background layer as separate jpgs, but this code does not recognize the layer mask.

Can anyone help?

(define (batch-process-psd-image-maskV2 in1)
;; to run: gimp -b "(batch-process-psd-image-maskV2 \"MaskTest\")"
(let*
(
(inExt (string-append in1 ".psd" ))
(image (car (gimp-file-load RUN-NONINTERACTIVE inExt inExt)))
)
(let* (
(layers (vector->list (cadr (gimp-image-get-layers image))) )
)
(while (not (null? layers))
(car (gimp-edit-copy (car layers ) ))
(let* (
(imgLayer (car (gimp-edit-paste-as-new)))
(layerName (car (gimp-drawable-get-name (car layers) ) ))
(jpgExt (string-append layerName "_LAYER.jpg" ))
(mskName (string-append layerName "_MASK.jpg" ))

(drwLayer(aref (cadr (gimp-image-get-layers imgLayer)) 0) )
)
(if (= TRUE (car ( gimp-drawable-is-layer-mask drwLayer ) ) )
(gimp-file-save RUN-NONINTERACTIVE imgLayer drwLayer mskName mskName )
)
(gimp-file-save RUN-NONINTERACTIVE imgLayer drwLayer jpgExt jpgExt)
(gimp-image-delete imgLayer) ;; clean up
) ;; let - layer info
(set! layers (cdr layers ))
) ;; while
) ;; let - loop
(gimp-quit 0)
)
)
Members don't see the above ad. Register now - it's free!
clhaag
Newbie
 
Posts: 5
Joined: Fri Oct 23, 2009 3:33 pm

Re: Gimp-drawable-is-layer-mask doesn't recognize layer as mask

Postby clhaag » Tue Nov 03, 2009 7:00 pm

Problem solved.

Took out the "copy ...to new" and was able to get the sizes and offsets of the layers and masks.
clhaag
Newbie
 
Posts: 5
Joined: Fri Oct 23, 2009 3:33 pm


Return to Other

Who is online

Users browsing this forum: No registered users and 4 guests