Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions scripts/gimpscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
(define (script-fu-set-all-layers-invisible inImage inDrawable)
(let* (
(layers (gimp-image-get-layers inImage))
(num-layers (car layers))
(layer-array (cadr layers))
(layer-array (car layers))
(num-layers (vector-length layer-array))
(theLayer)
)

(gimp-image-undo-group-start inImage)

(while (> num-layers 0)
(set! num-layers (- num-layers 1))
(set! theLayer (aref layer-array num-layers))
(if (= (car (gimp-drawable-get-visible theLayer) ) TRUE)
(gimp-drawable-set-visible theLayer FALSE)
(set! theLayer (vector-ref layer-array num-layers))
(if (= (car (gimp-item-get-visible theLayer) ) TRUE)
(gimp-item-set-visible theLayer FALSE)
)
)

Expand Down Expand Up @@ -46,10 +46,9 @@
(let*
(
(image (car (gimp-file-load RUN-NONINTERACTIVE inImageName inImageName)))
(visibleStuff (car (gimp-image-get-active-layer image)))
(layers (gimp-image-get-layers image))
(num-layers (car layers))
(layer-array (cadr layers))
(layer-array (car layers))
(num-layers (vector-length layer-array))
(thisLayer -1)
(thisNumLayers 0)
(theseLayers layers)
Expand All @@ -66,24 +65,23 @@
; iterate through all layers of the image
(while (> num-layers 0)
(set! num-layers (- num-layers 1))
(set! thisLayer (aref layer-array num-layers))
(set! thisLayerName (car (gimp-drawable-get-name thisLayer)))
(set! thisLayer (vector-ref layer-array num-layers))
(set! thisLayerName (car (gimp-item-get-name thisLayer)))
; (gimp-message (string-append "Image Layer-Name: " thisLayerName))

; iterate through all layer Names we shall use
(set! layerNames inLayerNames)
(while (not (null? layerNames))
; if layerName matches this user supplied layername: make it visible
(if (string=? (car layerNames) thisLayerName)
(gimp-drawable-set-visible thisLayer TRUE)
(gimp-item-set-visible thisLayer TRUE)
)
(set! layerNames (cdr layerNames))
)
)

; Merge all visible layers into one layer which we then save to the given filename
(set! visibleStuff (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
(file-png-save RUN-NONINTERACTIVE image visibleStuff outImageName outImageName 0 9 0 0 0 0 0)
(file-png-export #:run-mode RUN-NONINTERACTIVE #:image image #:file outImageName #:interlaced FALSE #:compression 9 #:bkgd FALSE #:offs FALSE #:phys FALSE #:time FALSE #:save-transparent FALSE)
(gimp-image-delete image)
)
)
Expand Down