Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

3.4.  The Selection

Revision History
Revision $Revision: 1.23 $ 2006-03-31 j.h

Often when you operate on an image, you only want part of it to be affected. In GIMP, you make this happen by selecting that part. Each image has a selection associated with it. Most, but not all, GIMP operations act only on the selected portions of the image.

Figure 2.15.  How would you isolate the tree?

How would you isolate the tree?

There are many, many situations where creating just the right selection is the key to getting the result you want, and often it is not very easy to do. For example, in the above image, suppose I want to cut the tree out from its background, and paste it into a different image. In order to do this, I need to create a selection that contains the tree and nothing but the tree. It is difficult because the tree has a very complex shape, and in several spots is hard to distinguish from the objects behind it.

Figure 2.16.  Selection shown as usual with dashed line

Selection shown as usual with dashed line

Now here is a very important point, and it is crucial to understand this. Ordinarily when you create a selection, you see it as a dashed line enclosing a portion of the image. The idea you could get from this is that the selection is a sort of container, with the selected parts of the image inside, and the unselected parts outside. This concept of the selection is okay for many purposes, but it is not really correct.

Actually the selection is implemented as a channel. In terms of its internal structure, it is identical to the red, green, blue, and alpha channels of an image. Thus, the selection has a value defined at each pixel of the image, ranging between 0 (unselected) and 255 (fully selected). The advantage of this approach is that it allows some pixels to be partially selected, by giving them intermediate values between 0 and 255. As you will see, there are many situations where it is desirable to have smooth transitions between selected and unselected regions.

What, then, is the dashed line that appears when you create a selection?

It is a contour line, dividing areas that are more than half selected from areas that are less than half selected.

Figure 2.17.  Same selection in QuickMask mode

Same selection in QuickMask mode

You should always bear in mind, when looking at the dashed line that represents the selection, that it only tells you part of the story. If you want to see the selection in complete detail, the easiest way is to click the QuickMask button in the lower left corner of the image window. This causes the selection to be shown as a translucent overlay atop the image. Selected areas are unaffected; unselected areas are reddened. The more completely selected an area is, the less red it appears.

QuickMask mode, and its uses, are described in detail below. Meanwhile, if you are following this discussion by trying things out in GIMP, you should know that many operations work differently in QuickMask mode, so go ahead and toggle it off again for now (by clicking the QuickMask button once more).

Figure 2.18.  Same selection in QuickMask mode after feathering

Same selection in QuickMask mode after feathering

3.4.1.  Feathering

With the default settings, the basic selection tools, such as the Rectangle Select tool, create sharp selections. Pixels inside the dashed line are fully selected, and pixels outside completely unselected. You can verify this by toggling QuickMask: you see a clear rectangle with sharp edges, surrounded by uniform red. In the Tool Options, however, is a checkbox called “Feather edges”. If you enable this, the tool will instead create graduated selections. The feather radius, which you can adjust, determines the distance over which the transition occurs.

If you are following along, try this out with the Rectangle Select tool, and then toggle QuickMask. You will now see that the clear rectangle has a fuzzy edge.

Feathering is particularly useful when you are cutting and pasting, in helping the pasted object to blend smoothly and unobtrusively with its surroundings.

Actually, it is possible to feather a selection at any time, even if it was originally created as a sharp selection. You can do this from the image menu, by choosing Select->Feather. This brings up a dialog that allows you to set the feather radius. You can do the opposite--sharpen a graduated selection into an all-or-nothing selection--by choosing Select->Sharpen.

[Note] Note

For technically oriented readers: feathering works by applying a Gaussian blur to the selection channel, with the specified blurring radius.

3.4.2.  Making a selection partially transparent

You can set layer opacity, but you cannot do that directly for a selection. It is quite useful to make the image of a glass transparent. You can achieve this by using these methods:

  • For simple selections, use the Eraser tool with the wanted opacity.

  • For complex selections: use the command Selection->Floating to create a floating selection. This creates a new layer called “Floating Selection”. Activate it and use the opacity slider to get the wanted opacity. Then anchor the selection: outside the selection, the mouse pointer comes with an anchor icon. When you click, the floating selection disappears from the Layer Dialog and the selection is at the right place and partially transparent (anchoring works this way only if a selection tool is activated : you can also use the command in the context menu that you get by right clicking on the selected layer in the layer dialog).

    And, if you use this function frequently: Ctrl-C to copy the selection, Ctrl-V to paste it, creating so a floating selection, adapt the opacity then make Layer/New Layer that pastes the floating selection into the new layer. You can also create a shortcut for the New Layer command to use keys only.

  • Another way: Layer->Mask->Layer mask to add a layer mask to the layer with the selection, initializing it with the selection. Then use a brush with the wanted opacity to paint the selection with black, i-e paint it with transparency. Then Layer/Mask/Apply Layer Mask. See Section 2.1.3, “ Layer masks.


 
 
  Published under the terms of the GNU General Public License Design by Interspire