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 
modify
; it under the terms of the GNU General Public License as 
published by
; the Free Software Foundation; either version 2 of the License, 
or
; (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
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; 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)))
      viewable))
  (let* (
      (active-layer (car (gimp-image-get-active-layer image)))
      (source-layer)
      (source-mask)
      (layers)
      (mask))
   (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)
      (begin
        (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) 
source-mask)))))
      (set! layers (cdr layers)))
  (gimp-image-remove-layer image source-layer)
  (gimp-image-undo-group-end image)
  (gimp-displays-flush)))

(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"
 "6/14/2006"
 ""
 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
http://counter.li.org/
Linux User #246504
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user

Reply via email to