10-31-2016, 09:06 AM 
	
	
	
		Bonjour to all!
Espermaschine's comment reminded me of a utility I developed recently:
I hope this script will be usefull to some of us.
	
	
	
Espermaschine's comment reminded me of a utility I developed recently:
Code:
; 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.
;; This script adds a channel as mask to the active layer
;; Renames active layer as "LayerName : MaskName"
;; Script will show in right-click on active layer
;; Script will show in Layer/Mask menu
(define (nb-add-mask-from-channel inImage inLayer inChannel)
  (gimp-image-undo-group-start inImage)
  (gimp-image-set-active-channel inImage inChannel)
  (let* ( 
            (layer-name (car (gimp-item-get-name inLayer)))
            (active-channel inChannel)
            (active-channel-name (car (gimp-item-get-name active-channel)))
            (new-mask (car (gimp-layer-create-mask inLayer ADD-CHANNEL-MASK)))
        )
    (gimp-layer-add-mask inLayer new-mask)
    (gimp-item-set-name inLayer (string-append layer-name " : " active-channel-name))
  )
    (gimp-image-undo-group-end inImage)
    (gimp-displays-flush)
  )
(script-fu-register "nb-add-mask-from-channel"
  "Add Mask from existing Channels to active Layer; rename layer Layer : Mask"
  ""
  "Nicolas Beaudet"
  "photographie.nb@gmail.com"
  "2016.07"
  "*"
  SF-IMAGE    "Image"    0
  SF-DRAWABLE "Drawable" 0 
  SF-CHANNEL    "Channel" 1
  )
  
(script-fu-menu-register "nb-add-mask-from-channel"
  "<Layers>"
  )
 (script-fu-menu-register "nb-add-mask-from-channel"
  "<Image>/Layer/Mask/Modify"
  )I hope this script will be usefull to some of us.

 

 
