Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Painless use of selection tools
#1
A couple of  techniques that work with all selection tools, once you know that:
  • You can save your current selection (Select/Save to channel)
  • Channels can operate on the current selection: bluntly replace it, but also be added, subtracted, intersected with it
  • Channels appear in the "Channels" dialog   (Windows/Dockable Dialogs/Channels)
Then, you have two modes of operation:

The "cumulative":
  • Do some selection
  • Save selection to channel
  • Start new selection part in "addition"/"subtraction"/"intersection" mode, with some possible overlap with current selection (shift-click, usually, but for scissors you have to "shift-enter" at the end (instead of plain "enter"))
  • Save the new selection to a channel (and keep the old one)
  • Etc...
With this method you can undo by just restarting with a previous step, and you see your final selection coming, but you cannot easily rework the first selections.

The "stitched pieces":
  • Do some selection
  • Save selection to channel
  • Repeat (with some overlap most of the time)
  • Once done, use the Channels dialog to add/subtract/intersect the channels to the current selection
Slightly more manual at the end, and I recommend to name each selection. But you can redo any selection easily, and have each selection with a different feathering amount.

For all methods:
  • Since you spent so much time doing these selections, save the final selection, too. May come in handy.
  • As long as you save the image with as XCF, the selections that you saved as channels are saved with it. You can interrupt your work... or at least do periodic and useful saves of the image.
  • Nothing says you have to use the same selection tool all along... you can use the best tool for each partial selection.
Reply
#2
Saving selections in a channel also makes a great combination with layermasks, because it becomes a one-click action (apply mask from channel), instead of:
select - add layermask from selection - deselect.
Reply
#3
Bonjour to all!

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.
Reply
#4
I missed this post....

Thanks for your script, nbeaudet, i will see if i can integrate it into my workflow.
Reply
#5
Save To Channel?
I didn't know you could do it from interface (DUH), knew I could do it in script.
Great tips.
Reply
#6
When you write scripts, you have to know the application well, otherwise you may find yourself recoding the wheel Smile Remember that thread over there where one good half of all the wishes were already implemented in native Gimp, and another quarter existed as scripts or plugins?
Reply
#7
Thanks, Ofnuts; the series of tutorials on GIMP forums by you and other moderators/members has started here also. Hope it will prove useful for all.
Reply


Forum Jump: