The Foreground Select Tool in GIMP is one of the largely automated selection tools that can be used to quite quickly and easily make complex selections which may be difficult to produce in other ways. It should be noted that the effectiveness of the tool can depend on the image that you're working on and the area that you wish to select. The Foreground Select Tool works best on clearly defined areas of an image.
The following steps should serve as an introduction to the Foreground Select Tool and help you to get started using it to produce your own selections.
1. Open An Image
You'll want to ideally select an image that has strong contrast between the subject and the background. I've selected an image taken shortly after sunrise which has reasonable contrast between the foreground and the sky, but would be quite difficult to manually make a selection of either part of the image.
2. Duplicate Background Layer
This step and the next may not be necessary for your image, but I've included it here to show you that you can manipulate an image first before making a selection. In cases where the Foreground Select Tool is struggling to make an acceptable selection, you may consider adjusting an image first. In reality, it is often too much to expect a completely accurate selection from the Foreground Select Tool, but tweaking contrast can sometimes help, though it can also make it harder to see the mask preview.
First you duplicate the background layer by going to Layer > Duplicate Layer. You can then adjust the contrast of this layer to make it easier for the Foreground Select Tool to operate, without losing the original image.
3. Increase Contrast
To increase contrast, go to Colors > Brightness – Contrast and drag the Contrast slider to the right until you're happy with the result.
This new layer can be deleted once the selection has been created, but in this example I'm going to use the sky from this layer, and combine it with the original foreground from the layer below.
4. Draw a Rough Selection Around the Subject
You can now select the Foreground Select Tool from the toolbox and initially leave all the Tool Options to the default settings. If you've ever adjusted these previously, you can click the Reset to default values button the to bottom right of the Tool Options dock.
The cursor will now operate in the same way as the Free Select Tool and you can draw a rough outline around the object that you wish to select. This does not need to be especially accurate, though better accuracy should lead to a better selection. Also you should avoid having any areas of the subject fall outside this outline.
5. Paint on The Foreground
When the selection is closed, the area of the image outside of the selection has a colored overlay. If the color is too similar to the image that you are working on, you can use the Preview color drop down in the Tool Options to change to a contrasting color.
The cursor will now be a paint brush and you can use the slider under Interactive refinement to adjust the size. When you're happy with the brush size, you can use it to paint the subject. Your aim to is paint over all the colors that you want the selection to include, without painting on any background areas. This can be very rough as shown in the accompanying screen grab. When you release the mouse button, the tool will automatically make the selection.
6. Check the Selection
If things have gone well, the edge of the clear area without a color overlay should quite closely match the subject that you want to select. However if the selection isn't as accurate as you'd like, you can edit it by painting on the image as many times as you like. If the Interactive refinement is set to Mark foreground, the areas that you paint on will be added to the selection. When set to Mark background, areas that you paint over will be removed from the selection.
7. Activate the Selection
When you're happy with the selection, you just press the Return (Enter)key to make the selection active. In my example, the dark foreground makes it difficult to see how effective the selection is, so I just clicked and hoped, knowing that as I was going to use the selection to make a mask, I could always edit the mask later.
To make the Layer Mask, I just right click on the layer in the Layers palette and select Add Layer Mask. In the Add Layer Mask dialog, I clicked the Selection radio button and checked the Invert mask checkbox. That sets the mask to show the sky and allows the foreground from the layer below to show through.
GIMP's Foreground Select Tool can be a powerful tool for making complex selections that would otherwise be difficult to achieve in a natural looking way. It can, however, sometimes need tweaking to get effective results with certain images. You should always consider whether it is actually the most appropriate tool for the specific selection and image that you are working on.