3.1 The Basic Selection Tools
Keywords: GIMP, gimp, Gimp, GNU Image Manipulation Program, gnu image manipulation program, Gimp tutorials, GIMP tutorials, gimp tutorials, Linux applications, linux applications, editing digital images, digital image editing, photo touchup, photo enhancement, enhancement photos, touchup, enhancement, image touchup, image enhancement, enhancement images, touchup images, digital collage, collage, compositing, photo montage, montage, photos, images, stock photos, copyright free photos, selection, selections, mask, masks, color correct, color correction, colorspace, colorspaces, RGB, rgb, hsv, HSV, free-hand tool, free hand tool, lasso tool, bezier path tool, Bezier path tool, layer mask, layer masks, layer, layers, gradient tool, gradients, blend tool, blending, threshold tool, thresholding, histogram, curves tool, curves, levels tool, levels, color picker, eyedropper, wilber, wilber the gimp, Wilber the GIMP, magic wand, fuzzy-select tool, fuzzy select tool, crop tool, transform tool, text tool,  [cell cut: 1485 characters, first 1000 kept]

Next: 3.2 Combining Selections Up: 3. Selections Previous: 3. Selections
Subsections

- 3.1.1 The Six Selection Tools from the Toolbox
  - 3.1.1.1 The `Rectangle Select` and `Ellipse Select` Tools
  - 3.1.1.2 The `Lasso` (the `Free-Hand Selection` Tool)
  - 3.1.1.3 The `Magic Wand` (the `Fuzzy Select` Tool)
  - 3.1.1.4 Bezier Paths
  - 3.1.1.5 The `Intelligent Scissors`
- 3.1.2 Selection Tool Options
  - 3.1.2.1 Antialiasing
  - 3.1.2.2 Feathering
  - 3.1.2.3 Sample Merged
  - 3.1.2.4 Threshold

#
3.1 The Basic Selection Tools

There are two types of selection tools. The first type works by drawing lines that separate the selection subject from its background. The second type makes a selection by specifying a representative seed pixel from the subject. The selection is then made automatically by including other pixels in the image that are sufficiently similar to the seed in color.

A goal of this chapter is to explain how to decide which type of selection tool should be applied. Often it is some combination that is the most effective. The decision is partially based on evaluating the characteristics of the subject that best differentiate it from the background. These could be a combination of its color, shape, value, or saturation (for more on the characteristics of color, value, and saturation, see Chapter 5). For difficult selections it is often necessary to experiment in order to discover the most effective approach.

## 3.1.1 The Six Selection Tools from the Toolbox

In this section we start to develop our skills by reviewing the GIMP's basic selection tools and by exploring their underlying strengths and weaknesses. To begin, we discuss the six selection tools found in the GIMP Toolbox, shown in Figure 3.1. They consist of the `Rectangle Select`,

Figure 3.1: Toolbox Selection Tools

the `Ellipse Select`, the `Free-Hand Select` (also known as the `Lasso`), the `Fuzzy Select` (known as the `Magic Wand`), the `Bezier Path` tool, and the `Intelligent Scissors`. Of these, the `Bezier Path` and the `Lasso` are the most useful. `Rectangle Select` is also of some use. Of less use are the `Magic Wand` and `Ellipse Select` tools. Finally, although the `Intelligent Scissors` has an intriguing name, there is nothing this tool can do that can't be done better and more efficiently using other tools.

###
3.1.1.1 The `Rectangle Select` and `Ellipse Select` Tools

The `Rectangle Select` and `Ellipse Select` tools are used for selecting rectangular and elliptical regions in an image. A selection is initiated by clicking and dragging in the image window, and the selection is completed by releasing the mouse button. The selection process is interactively facilitated by an outline of the selection that can be seen while the mouse is being dragged.

Figure 3.2 shows examples of both the `Rectangle Select` and `Ellipse Select` tools.

Figure 3.2: The `Rectangle Select` and `Ellipse Select` Tools

When completed, selections are displayed as moving dashed lines, traditionally referred to as the Marching Ants. In the figure, the arrows are just for illustrating where the selections begin and end. They don't actually appear when you use these tools. The arrows' tails show where the selections were initiated, and the heads show where they were terminated. Note that for the `Ellipse Select` tool the selection is inscribed in a rectangle defined by the arrow's head and tail.

A perfectly square selection can be made with the `Rectangle Select` tool, and a perfectly circular selection can be made with the `Ellipse Select` tool. The trick is to use the Shift key, but read on carefully. Two other selection tricks are also performed with the Shift key (see Section 3.2 for the other). To avoid confusion, it is important to pay close attention to how this works.

To obtain a perfectly square or circular selection, begin the selection by clicking and dragging in the image window. While the mouse button is down, press the Shift key. In the image window, the resulting selection shape becomes a perfectly square or circular, depending on the tool you are using. The Shift key must remain pressed until the selection is finished and the mouse button has been released. Only then may the Shift key be released. If the Shift key is released before the left mouse button, the selection will revert to a normal rectangle or ellipse selection. The results of using the Shift key with the `Rectangle Select` and `Ellipse Select` tools are illustrated in Figure 3.3.

Figure 3.3: Making Perfectly Square and Circular Selections with the `Rectangle Select` and `Ellipse Select` Tools

Instead of initiating a rectangular or elliptical selection at one corner and terminating at the opposite one, it is also possible to initiate from the selection's center, terminating at a corner. The trick for this is similar to the technique just described for creating a perfectly square or circular selection. It is done by pressing the Control key after initiating the selection with the left mouse button. The Control key must remain pressed until after the mouse button is released. To combine perfectly square or circular selections in conjunction with center initiated ones, the Shift and Control keys must both be pressed after the left mouse button is clicked and remain so until after the mouse button is released.

###
3.1.1.2 The `Lasso` (the `Free-Hand Selection` Tool)

The `Lasso` is used to draw free-hand selections. Although its official name is the `Free-Hand Selection` tool, the `Lasso` will be preferred in this book because the tool's icon in the Toolbox resembles a lasso (and it's also a lot shorter to type).

The `Lasso` is used by clicking and dragging in the image window, tracing out the shape to be selected. Releasing the mouse button completes the selection. While tracing with the `Lasso`, the outline of the selection can be seen, and, when completed, the selection is shown by the Marching Ants. Figure 3.4

Figure 3.4: A `Lasso` Selection

shows an example of a `Lasso` selection.

The advantage of the `Lasso` is that it can be used to select arbitrarily complex objects. The disadvantage is that the work can be painstakingly slow, requiring extremely fine control of the mouse. Even the small selection shown in Figure 3.4 was difficult, because the tree's outline is so jagged and rough. Another aspect of the `Lasso` that makes it difficult for precision work is that the mouse button cannot be released while the selection is being made. This precludes using this tool for making large, complicated selections. For these reasons, the `Lasso` will not be our selection tool of choice for fine-grain work. Rather, it will mainly be used to rough-out selections around complicated shapes or for completing work on masks. A good example of the latter use of the `Lasso` is demonstrated in Sections 4.5.3 and 7.4.

###
3.1.1.3 The `Magic Wand` (the `Fuzzy Select` Tool)

Although its name is officially the `Fuzzy Select` tool, the `Magic Wand` will be preferred in this book because the tool's icon, as shown in the Toolbox, resembles a magic wand. The `Magic Wand` makes selections based on specifying a seed pixel in the image. The seed is the first selected pixel, and the pixels directly adjoining the seed are included in the selection if their colors are sufficiently close to the color of the seed. This creates a second set of selected pixels. This process is repeated with the neighboring pixels of the second selected set, and so on, until no more pixels can be added.

Figure 3.5 illustrates how the `Magic Wand` works.

Figure 3.5: A `Magic Wand` Seed Pixel and Selection

Figure 3.5(a) shows a smoothly-varying, radial gradient of pixel values going from black at the center to white at the edges. The location where the seed was chosen with the mouse is indicated. The resulting ring-like region selected by the `Magic Wand` is shown by the Marching Ants. The ring selection is equally thick on both sides of the seed because the `Magic Wand` includes pixels that have both higher and lower color values than the seed's.

So, how much lower and higher can adjoining pixel colors be and still be included in the selection? This is specified by the `Magic Wand`'s selection threshold, which, as shown in Figure 3.5(b), can be set with the Threshold slider in the `Tool Options` dialog (see Section 3.1.2 for more on this). It can also be set interactively with the mouse. The threshold is set interactively by keeping the left mouse button pressed when selecting the seed pixel. When the outline of the selection appears, and with the left mouse button continually pressed, the mouse can be moved either to the right (or downward) to increase the threshold or to the left (or upward) to diminish it. Increasing the threshold results in a larger selection, and decreasing it, a smaller one. Changing the threshold should be done by moving the mouse in small increments so that the changes in the selected region can be carefully controlled.

The `Magic Wand` is a conceptually attractive tool. In principle, it automatically makes the selection by grouping pixels that are similar in color and that are spatially connected, being grown from a seed pixel. In practice, however, it is often difficult to get good results with the `Magic Wand`. This is because it is hard to find the seed pixel and threshold pair that will produce the selection we want. As an example, imagine a subject you want to select using the `Magic Wand` and that has pixel color values ranging from X to Y. To make the selection with the `Magic Wand`, a pixel whose value is exactly midway between X and Y must be selected as the seed. But how do we determine what X and Y are for our subject, and how do we find the pixel in the subject that has the midway value? These practical problems are not easily solved!

Fortunately there is another tool in the GIMP that allows you to more easily exploit the color-grouping selection concept. This tool is called `Threshold` and is found in the `Image:Image/Colors` menu. Its use is presented in Section 4.5.3.

###
3.1.1.4 Bezier Paths

The `Bezier Path` selection tool is very powerful. It is the only selection tool that allows the interactive adjustment of the selections it makes. The `Bezier Path` tool works by placing control points on an image. These are initially connected by straight-line path segments; however, using the control handles hidden inside each control point, the path segments can be made to curve in practically arbitrary manners. By using a Bezier path, an initial selection can be interactively corrected until the final result fits the desired selection like a glove.

Figure 3.6

Figure 3.6: Using the Bezier Control Points and Handles: (a) A Bezier path, (b) Simultaneously manipulating two control handles of a control point, (c) Manipulating an individual control handle, and (d) Moving a control point.

illustrates the basic operations of a Bezier path. The initial Bezier path shown in Figure 3.6(a) was created by clicking in the image window five times. The upper-left corner was the first point, and the lower-left, lower-right, and upper-right corners were the second, third, and fourth points added to the path. The final click of the mouse was made on the initial point, thus closing the path. As each point was added, the straight-line segments seen in the figure appeared between the control points.

While constructing a Bezier path, the mouse cursor appears as an arrow, with a filled circle just below and slightly to the arrow's right. This circle indicates that the path is not closed and that the next mouse click will create a new control point. Note that Bezier paths need not be closed. This is discussed in more detail in Section 3.4, which describes the Paths dialog.

The path segments between control points can be made to curve by manipulating the points' control handles. For a closed Bezier path, the control handles are made visible by clicking on a control point and dragging. Figure 3.6(b) shows how the control handles for the upper-left corner of the Bezier path have been pulled out of that control point. The dragging action of the mouse positions one of the control handles while the other moves in tandem with, but diametrically opposite, the first. As can be seen in Figure 3.6(b), the two path segments attached to the control point are made to curve by the action of the control handles.

Note that the control handles do not disappear once the mouse button has been released and that the handles can be readjusted at any time by clicking the mouse on either handle and dragging. However, only one set of handles may be visible at once. Clicking on another control point displays its handles while toggling off the visibility of the handles for any other point. Also note that when the mouse cursor is close enough to a control point or control handle to manipulate it, the cursor changes from an arrow with a filled circle below it to an arrow with the outline of square. Because control handles resemble squares, this special cursor is a useful way to indicate that the mouse cursor is close enough to the control point for the handles to be active.

The two control handles for a point can be moved independently of each other by using the Shift key. Pressing the Shift key while dragging a handle with the mouse makes that handle move while the other remains stationary. Moving a single control handle in this way allows the curvature of a single path segment to be manipulated. Figure 3.6(c) shows the result of using the Shift key to move one of the control handles independently of the other. Note how this changes the curve of the upper segment of the square while leaving the curve of the left segment as it was.

It is also possible to reposition a control point. This is done by pressing the Control key before clicking on a control point. Dragging the mouse while the mouse button and Control key are pressed moves the control point. The result of repositioning a control point is shown in Figure 3.6(d).

After creating a Bezier path with all the control points properly positioned and all the path segments appropriately curved, it may then be converted to a selection. This is done by clicking inside the closed path. Note that when the mouse cursor is moved inside the closed path, the cursor changes to an arrow with the outline of a dashed rectangle below it. The dashed rectangle resembles the Marching Ants, which will appear when the Bezier path is converted to a selection.

Figures 3.7 through 3.9 show the application of the `Bezier Path` tool in a practical example. Figure 3.7 shows that a closed Bezier path has

Figure 3.7: Creating a Bezier Path

been created by placing seven control points around the perimeter of a sea turtle's shell. Although the points are all positioned on the edge of the shell, the straight-line segments between points do not marry well to the shell's shape.

As just described, the Bezier path can be adjusted to the shell's shape by manipulating the control handles. The first pair of handles are shown in Figure 3.8.

Figure 3.8: Manipulating the Control Handles of a Bezier Control Point

The two handles had to be adjusted independently of each other to properly match the curve of the shell on either side of the control point. This can be seen in the figure by the different lengths of the control handles and by the slight angle between them.

After adjusting the control handles for each point in the Bezier path it is converted to a selection. The result, showing the Marching Ants, is illustrated in Figure 3.9.

Figure 3.9: Selection Created from the Bezier Path

What is particularly interesting about this example is that the selection has been made with only a few control points. This is a strength of this tool. However, there are limitations to what can be accomplished with a Bezier path. A very irregular shape will need many control points and will require a lot of work to adjust the path to the shape.

A practical question is where should the control points be placed? Another is how many control points are necessary to adequately select a shape? For the placement of control points here are some rules of thumb:

- A control point must always be placed at a corner (like the one found at the rear-most point of the sea turtle's shell in Figures 3.7 through 3.9).
- A straight-edge region can only be created by placing a control point at each end of the edge, as shown in Figure 3.10(a).
- An inflection point on a curve can be created between a pair of control points, as shown in the bottom path segment of Figure 3.10(b). It can also be created with a single control point if this is placed exactly at the point of inflection.

Figure 3.10: The Required Number of Bezier Control Points?

The number of control points needed to adequately adjust a Bezier path to a shape is a more difficult question. Figure 3.10(c) shows that a pair of control points are all that is needed to create a circle. Thus, a single control point can cover up to 180 degrees of curve. However, this doesn't account for all curve characteristics. I personally like to place control points as the shape of my selection passes through 90 degrees of curve. This personal rule is borne out in the sea turtle selection shown in Figures 3.7.

In any case, the issue of the number of points required for a shape is not critical because it can be resolved using the Add Point and Delete Point functions available in the Paths dialog. These are discussed in detail in Section 3.4.

###
3.1.1.5 The `Intelligent Scissors`

In principle the `Intelligent Scissors` is supposed to work by following, as closely as possible, constant-valued color contours in the image between subsequent points clicked by the mouse. However, at the time of this writing, the `Intelligent Scissors` is a GIMP tool that seems to be broken. Much perplexed discussion has passed through the GIMP developers' mailing list on this tool and, unfortunately, it seems that for the present this tool has little or no value. Even if the tool did work, I would still rank it as a tool of little utility.

##
3.1.2 Selection Tool Options

Double-clicking on any of the Toolbox icons brings up the `Tool Options` dialog for that tool. For selection tools the important options are Antialiasing, Feather, Sample Merged, and Threshold. Each of these is discussed in this section.

###
3.1.2.1 Antialiasing

Antialiasing is an important edge treatment for selections. Figure 3.11

Figure 3.11: How Antialiasing Works

illustrates the antialiasing concept. Figure 3.11(a) shows an array of pixels that has been partitioned into two regions by a selection edge. However, due to the slope of the selection and the finite area of the pixels, some pixels are on both sides of the selection edge. That is, these pixels are only partially selected. What happens to this set of partially selected pixels is important for the aesthetic presentation of the selection's edge.

For example, let's assume that white represents a selected pixel and black an unselected one. Figure 3.11(b) shows what happens if pixels are included in the selection when more than 50% of the pixel is above the selection edge and unselected otherwise. This seems like a reasonable criterion, however, notice that the selection edge obtained by applying this rule produces a staircase effect on the edge. This staircase effect, known as aliasing, makes the edge look harsh. We'll see this in a more realistic example in a moment.

Alternatively, Figure 3.11(c) illustrates the concept of antialiasing. Here white represents a pixel which is fully selected, black one that is fully unselected, and gray represents partially selected pixels, where the level of gray indicates the percentage of the pixel that falls inside the selection. Thus, a lighter value of gray indicates a more fully selected pixel and a darker value a less selected one. Assigning gray values to partially selected pixels has the effect of visually smoothing the staircase effect illustrated in Figure 3.11(b), which is why this is called antialiasing.

The way antialiasing is actually implemented is by using the layer's alpha channel. Alpha channels were introduced in Section 2.2 and a more comprehensive presentation of them is given in Chapters 4 and 5. However, for the purposes of discussing antialiasing it is sufficient to know that the white pixels in Figure 3.11(c) represent pixels that are fully opaque, the black pixels those that are fully transparent, and the gray pixels those that are partially opaque (or transparent).

Figure 3.12

Figure 3.12: A Practical Example of Using Antialiasing

illustrates a more realistic example of aliased and antialiased pixels. Figures 3.12(a) and (b) each show a circle created using the `Ellipse Select` tool. For both, the selections were filled with black using the `Bucket Fill` tool. The selection made in part (a) of the figure was made without antialiasing, and that in part (b) with. From these two figures it can immediately be seen that the antialiased circle seems to have a much smoother edge.

Figures 3.12(c) and (d) show zoomed versions of Figures 3.12(a) and (b). The staircase effect can be clearly seen in Figure 3.12(c). Alternatively, in Figure 3.12(d) there are black, edge pixels that are partially transparent and that allow part of the yellow background to show through. Figures 3.12(b) and (d) demonstrate that antialiasing really does improve the aesthetic appearance of the selection edge. Figure 3.12(e) shows that the Antialiasing checkbox in the `Tool Options` dialog for the `Ellipse Select` tool is toggled on for Figures 3.12(b) and (d). For all the selection tools, Antialiasing is on by default.

As a final remark, note that the `Rectangle Select` tool does not have an antialiasing option. This is normal because this selection tool can never produce sloping edges. Consequently, the staircase problem illustrated in Figure 3.11 can never occur, and antialiasing is not needed.

###
3.1.2.2 Feathering

Feathering is a selection edge treatment similar to antialiasing. It works by changing the alpha value of pixels as a function of their radial distance from the selection edge. Figure 3.13

Figure 3.13: The Effect of Feathering

illustrates an example of a feathered selection. Figure 3.13(a) shows how two guides have been placed to aid in framing a selection using the `Ellipse Select` tool.

As shown in Figure 3.13(b), a value of 40 has been chosen for the Feather Radius in the `Tool Options` dialog for this selection tool. Furthermore, Antialiasing has been turned off. The result of inverting the selection and cutting away the background is shown in Figure 3.13(c). This result is actually displayed on a yellow background so that the transparency of the flower pixels can be better seen. Also, superimposed on Figure 3.13(c) is the original elliptical selection.

The transparency of the flower image shown in Figure 3.13(c) is 50% at the selection edge. The transparency increases moving outward from the edge and decreases moving inward from it. The rate at which the transparency changes while moving away from the selection edge is determined by the Feather Radius. For this example, the value chosen is 40, meaning that there is a feathering effect up to 40 pixels away in both directions from the selection edge. Note that for all the selection tools, feathering is off by default.

Partially selected pixels are discussed again in Section 4.1.7.

###
3.1.2.3 Sample Merged

Normally the `Magic Wand` selection tool only operates on the pixel values in the active layer. However, if this layer is not fully opaque, or if this layer is using a blending mode (see Chapter 5), some of the pixel values from lower layers affect the color in the active layer. The Sample Merged option in the `Tool Options` dialog for the `Magic Wand` takes this into account. When this option is on, it is the merged color values of pixels that are used in the comparison algorithm for the `Magic Wand`. Figure 3.14

Figure 3.14: The Sample Merged Option

shows the Sample Merged option toggled on in the `Magic Wand`'s `Tool Options` dialog.

###
3.1.2.4 Threshold

As described in Section 3.1.1, the `Magic Wand` uses a search algorithm based on the color of a seed pixel and a specified threshold value. All contiguous pixels that have color values that are less than the threshold from the seed are included in the selection. As already described, the Threshold can be set interactively. However, it can also be specified in the `Magic Wand`'s `Tool Options` dialog. Figure 3.14 illustrates the Threshold slider which can take values from 0 to 255.

Next: 3.2 Combining Selections Up: 3. Selections Previous: 3. Selections
©2000 Gimp-Savvy.com