More about selection masks in GIMP (Part 7 of 14)

The ability to make selections in photo-editing software is one of the most important aspects of these software, because it allows the user to restrict adjustments to specific parts of a photo. Understanding how selections are represented in GIMP is essential to get the most out of GIMP.

Yesterday, we selected a youth, his laptop and table using a quick mask and transferred him via copy-and-paste into another photo background.

Abrupt seam because of sharp edge of the selection.

Abrupt seam because of sharp selection edge.

More seamless transition with the new background.

More seamless transition with the new background.

You might have noticed, on close inspection, that the edges looked a bit abrupt and jarring against the new background, especially where the colour of the new background was very different from that in the original background.

To make the foreground objects gel more seamlessly with the new background, you can soften the transition between the foreground objects and the background.

Feathering the selection

A large feather setting creates a vignette.

A large feather setting creates a vignette.

In normal selection mode, we can use the Select > Feather command to “feather” a selection before we do the copy-and-paste. This means that at the edge of the selection, the pixels go from fully visible inside the selection – to being translucent immediately on either side of the edge – to becoming totally invisible outside the selection.

How thick the translucent transition region is on either side of the selection edge depends on the feather setting used.

For yesterday’s example, the default feather amount of 5 pixels would have made the transition between the youth and the new background more natural and seamless. The transition also helps to mitigate imperfections when making the selection.

A large feather setting is used to create a vignette with a blurred edge.

Blurring a selection mask

The mask edge is sharp and abrupt.

The mask edge is sharp and abrupt.

Another way of feathering a selection edge is to apply a blur filter (Filters > Blur > Gaussian Blur at 1 to 2 pixels) to the selection mask while in Quick Mask mode. While in Quick Mask mode, the filter is applied to the mask instead of the image itself – so the mask is blurred.

We’ve seen that in Quick Mask mode, the areas with translucent pink overlay means that the pixels within are not selected, whereas the areas with no pink overlay means that the pixels inside are selected.

What if we paint some areas when the Foreground colour is set to gray? A lighter shade of translucent pink will be added as an overlay but this will be lighter than the pink added when the Foreground colour is set to black. In this case the pixels in those areas will only be partially selected.

The mask edge is blurred and smoothened.

The mask edge is blurred and smoothened.

Any effects/adjustments applied to pixels that are only partially selected will only be applied partially. For example, if a region in a photo is only 30% selected, and the selected area is subsequently darkened, those pixels will only be darkened up to 30% of whatever the darkening setting would have been.

Blurring the selection mask in Quick Mask mode will blur the edges pink selection mask, so that instead of an abrupt jump from fully masked to fully unmasked, a partially masked transition region is introduced. The partially masked transition region translates to a partially selected region.

Selection masks in photo-editing software

In fact, in GIMP and other photo-editing software, selections are represented as a grayscale image called a selection mask.

The white areas represent pixels that are fully selected, the black areas represent pixels that are totally not selected, while the gray areas represent pixels that are partially selected – with the darkness of the gray representing to what extent the pixel is partially selected (between 0 and 100%).

The selection mask is in grayscale.

The selection mask is in grayscale.

The Quick Mask shows which parts of a photo is selected.

The Quick Mask shows which parts of a photo is selected.

The pink overlay in Quick Mask mode is a means of showing the mask, while keeping the original photo visible at the same time, so that you can tell which parts of the photo is selected and to what extent.

Saving selections for future reuse or modification

As we saw in the photo of the youth, a selection can take a lot of time and effort to create. The selection is forgotten once we make another selection. What if we need to make the same selection in the future?

A selection can be saved as a channel in the Channels dialog for future use or manipulation. If the file is then saved in GIMP’s native .xcf format, the channel is saved as part of the file. And you can save many different selections as separate channels in the file.

Paint on the selection mask in the image window to modify it.

Paint on the selection mask in the image window to modify it.

To save a selection for future use, first make the selection, and then click the Select > Save to Channel command from the main menu. If you look in the Channels dialog, you will see a new channel at the bottom of the dialog. The selection has been saved as a grayscale selection mask in a new channel. Double-click on the name to rename it with something more meaningful.

To modify the selection, click the eye icon to display the selection mask. Click the channel containing the mask to select it.

Any changes or painting will now be applied to the mask rather than to the image. It’s like in Quick Mask mode, except the overlay is a translucent gray by default instead of pink. Paint on the mask (in the image window) with black, white or gray as the Foreground colour to modify the mask.

To get back to editing the photo instead of the mask, remember to hide the mask by clicking the eye icon against its channel in the Channels dialog. Then go to Layers dialog and select the layer that you want to edit.

Click on the pink icon to load the mask as a selection.

Click on the pink icon to load the mask as a selection.

To load a selection, click on the selection’s channel in the Channels dialog to select it and click the pink icon to the bottom right of the Channels dialog. This will load the selection mask in that channel as a selection in the photo.

Entire books have been written just to explain how to create, manipulate and use selections, masks and channels. A good understanding of how selections, masks and channels work will open doors to harnessing GIMP’s full capabilities and start doing things that other simpler photo-editing software cannot do.

Tags: , , ,

Leave a Reply