@ Scott,
Thank you very much for the script. I will give it a try.

@ David
A knockout, in general terms, is a layer that 'makes' a hole in the beneath
layers allowing to show the background layer. Picture this: you've a
background layer with an image, a layer that covers the background layer
with a color and a third layer, above all, that will punch a hole in the
middle layer allowing the background layer to appear. More explicit here:
Best regards,

2007/1/8, Scott Bicknell <[EMAIL PROTECTED]>:

On Monday 08 January 2007 1:40 am, Jorge Antunes wrote:

> Hi,
> I'm new to Gimp and i'm trying to find a way to duplicate in
> gimp a procedure that I've used in Photoshop.
> In photoshop I use extensively the layer grouping because
> layer's advanced blending knockout options.
> I know that layer grouping is not possible in Gimp, but I also
> canĀ“t find similar options to knockout blending.
> How can I, using Gimp, set a knockout layer?
> Best Regards,
> Jorge Antunes

You can achieve the same result using layer masks. Unfortunately,
there is not a simple built-in way of copying a layer mask to
multiple layers or of applying a layer mask to multiple layers.
There is a script-fu plugin that will do that. I don't know
where I got it. It doesn't seem to be in the Gimp's plugin
repository. So here it is:

; This program is free software; you can redistribute it and/or
; it under the terms of the GNU General Public License as
published by
; the Free Software Foundation; either version 2 of the License,
; (at your option) any later version.
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; GNU General Public License for more details.

(define (script-fu-copy-mask-to-layers image drawable)
(define (visible-layers img)
   (let* (
       (all-layers (gimp-image-get-layers img))
       (i (car all-layers))
       (viewable ())
       (tmp FALSE))
     (set! all-layers (cadr all-layers))
     (while (> i 0)
       (set! tmp (car (gimp-drawable-get-visible (aref
all-layers (- i 1)))))
       (if (= tmp TRUE)
         (set! viewable (append viewable (cons (aref all-layers
(- i 1))))))
       (set! i (- i 1)))
(let* (
     (active-layer (car (gimp-image-get-active-layer image)))
  (set! layers (visible-layers image))
  (gimp-image-undo-group-start image)
  (set! source-layer (car (gimp-layer-new-from-drawable
active-layer image)))
   (gimp-image-add-layer image source-layer -1)
   (set! source-mask (car (gimp-layer-get-mask source-layer)))
   (if (= source-mask -1)
       (set! source-mask (car (gimp-layer-create-mask
source-layer ADD-COPY-MASK)))
       (gimp-layer-add-mask source-layer source-mask)))
   (while (car layers)
     (if (= (car (gimp-layer-get-mask (car layers))) -1)
       (if (= (car (gimp-drawable-has-alpha (car layers))) 1)
         (set! mask (car (gimp-layer-add-mask (car layers)
     (set! layers (cdr layers)))
(gimp-image-remove-layer image source-layer)
(gimp-image-undo-group-end image)

(script-fu-register "script-fu-copy-mask-to-layers"
"<Image>/Script-Fu/_Copy mask"
"Copy the mask from the current layer to all visible layers"
"Saul Goode"
"Saul Goode"
SF-IMAGE    "Image"    0
SF-DRAWABLE "Drawable" 0

Just copy that to a separate file, name it with a .scm extension
and place it in your Gimp script-fu directory. You can find it
on your image Window's Script-fu menu at the bottom.

It will copy a layer mask to all visible layers, replacing any
masks that already exist, so be careful. You can create a mask
that punches a hole in one layer and use this plugin to apply
the same mask to all the other layers of an image.
73, AC7ZZ
Linux User #246504
Gimp-user mailing list

Gimp-user mailing list

Reply via email to