What is a Mask?
A mask defines an area of an image which has been selected by using one or more masking tools.
In the image opposite, a square mask has been created around the poppy flower head. It appears as a flashing outline around the area selected. This flashing line is generally referred to as ‘marching ants’.
The area inside the square of marching ants is referred to as a selection.
What can we do with Masks?
The main purpose of masks is to isolate an area of an image so that it can be adjusted independently without changing other parts of the image.
A useful analogy is a window frame about to be painted. Masking tape is often applied to the glass around the frame. This allows the frame to be painted while protecting the glass from the paint.
In the poppy example, the square selection has been darkened by applying a Levels adjustment. Other areas of the image remain unchanged.
A more realistic example could be a landscape where the sky is too bright and parts of the land are too dark. By using masks, it’s possible to adjust bright and dark areas separately.
Creating Masks
The business of creating masks is a two-step process:
- Creating Selections
- Saving Selections as Masks
Step 1: Creating Selections
This is always the first step in mask creation. It can be a simple or very complex operation depending on the nature of your subject and what you are setting out to do. Each of the masking tools offers a different way of making selections. The following possibilities are true for a wide variety of situations.
Use Masking Tools
Masking tools are often grouped according to the way in which they can be used to make selections. Some work with shape or subject, some are based on colour while others are based on brightness (luminosity). Different images will require different masking techniques. For example, a building with clear, straight edges will require the use of different tools from a portrait or a landscape.
In some cases, you may wish to create selections based on several different characteristics. This will require the use of multiple tools. For example you may wish to make a selection of bright areas which are red. In this case you would use a combination of luminosity and colour masking tools.
Many of the masking tools have several options which will appear in the Tool Options bar. These include:
- Feather: I usually leave this at 0 as a feather can be added after.
- Anti-Alias: This smooths and softens the edge of your selection. I leave this ticked at all times.
The masking tools and their uses are described in detail in the following pages of this module.
Build a selection
Many of the tools allow you to build the selection in multiple ‘moves’. Those masking tools which are selected from the Toolbar all have an associated Tool Options bar. The area to the left in the Tool Options (illustrated opposite) shows the 4 methods of operation:
- A: Start a New selection
- B: Add to selection
- C: Subtract from a selection
- D: Intersect with a selection
To explain how each of these work we’ll use an image with 3 coloured circles, each of which is on a separate layer. The starting point for each example is a selection of the blue and red circles – blue and red. In each case below, the yellow circle is then selected using the Magic Wand Tool.
Be aware that the different selections are denoted by the dotted lines which would normally be marching ants. The circles themselves are used only to create the selections. The changes in colour below are purely illustrative as nothing actually changes when a mask is created.
A: Start a New selection
When the yellow circle is selected, the selection of the blue and red circles is discarded. Only the yellow circle is selected.
B: Add to selection
When the yellow circle is selected, it is added to the selection so all 3 circles are selected.
C: Subtract from a selection
When the yellow circle is selected, it is subtracted from the selection. The blue and red circles each have a chunk removed from the area covered by the yellow circle.
D: Intersect with a selection
When the yellow circle is selected, only the areas where the yellow circle overlaps the other two circles are selected. Everything else is discarded from the selection.
Refine a Selection
Once a mask has been created, it can be refined using ‘Select and Mask’. The main reasons you might wish to refine a selection are to create a more precise mask or to create a subtle blend with no obvious ‘joins’ between the masked area and the surrounding area.
If a masking tool is still selected, click the ‘Select and Mask’ button on the tool Options bar. Alternatively, use Select Menu >> ‘Select and Mask’ or press CTRL ALT R. In every case, the Select and Mask Properties dialogue will be opened.
The Select and Mask Dialogue
View Mode
The dropdown offers a variety of ways to view your selection. Experiment with these to find which you find most useful.
Refine Mode
There are only two choices – Colour Aware and Object Aware. Colour Aware was the previous default. Object Aware has been added as new option using AI to do a better job with complex objects such as hair. Swapping between the two will pop up a warning dialogue which says that the selection edge may be altered and gives an option to cancel. Again experiment to see which is better.
Edge Detection
Increasing the radius with this tool causes Photoshop to attempt to refine the edges of a selection automatically. The higher the radius value, the more effect this will have. The trick is to use the smallest value which gets the job done. Smart Radius is useful when a selection has very irregular edges (such as hair). Tick the Show edges box in View Mode to see the extent of the border area which Photoshop will use to refine selection edges.
Global Refinements
The 4 sliders operate on the edges of your selection.
- Smooth does exactly what it says. The higher the value, the more smoothing will take place.
- Feather softens the edge of your selection. Again, high values will affect a greater area. Beware of ghosting (this creates a very visible halo around the edges of your selection) with values that are too high and in most cases try to find the smallest value which achieves the result you want.
- Contrast is the opposite of Feather and will harden the edges of a selection, making it more obvious.
- Shift Edge will move the edge of your selection either inwards or outwards. Zoom in to see how your selection changes. This is an excellent way to fine-tune the edges of your selections.
Clear Selection and Invert do exactly what they say!
Output Settings
Decontaminate colours can be used to eliminate any colour fringes around your selection. It will automatically create a new layer when you click OK as, by necessity, it changes pixels.
If Decontaminate Colours is unticked, you can output your selection in a variety of ways listed in the dropdown.
Toolbar
Select and Mask also opens a small toolbar at the top left of your screen with several tools which allow you to adjust your selection in a variety of ways. The tools on offer are:
- A: Quick Selection
- B: Refine Edge
- C: Brush
- D: Object Selection
- E: Lassos
- F: Hand
- G: Zoom
Most of these are duplicates of other tools and are grouped here for convenience. However, the Refine Edge Brush Tool is unique to Select and Mask. This is a very useful tool for refining the edges of complex selections like hair or tree branches. To use it:
- Create a selection using any of the selection tools.
- Zoom into the area you want to refine.
- Open Select and Mask.
- Select the Refine Edge Brush Tool and paint over the edge where you want a more precise selection. You may need to experiment with the size and hardness of the brush to get the desired effect.
This tool will produce the best results where there is good contrast between the subject and the background.
The zoomed-in example below gives an idea of what’s possible.
This close-up section of an image of a forget-me-not shows a roughly drawn lasso selection around the flower.
The Refine Edge Brush Tool was used to paint around the edges of the flower. This removed all of the black background while retaining a fair amount of detail in the ‘hairs’. Not a perfect result but a good starting point for further refinement.
Modify a Selection
Selections can also be modified. They can be feathered, smoothed, expanded, contracted or transformed. All of these options are available from the Select Menu.
Each of the modify options is described below
Border
This converts the selection to a border of a specified number of pixels. This has little relevance for photographic images.
Smooth
This will smooth the edges of your selection. The radius of the extent of smoothing can be set in pixels. The higher the number, the greater the smoothing effect. This can be useful to smooth out a selection with ragged edges.
Expand/Contract
Increase or decrease the size of the selection by a specified number of pixels. This is similar to the ‘Shift Edge’ function in Select and Mask, except it’s possible to move the edge by much larger amounts.
Feather
Apply feathering with a radius specified in pixels. This works in exactly the same way as the ‘Feather’ function in Select and Mask.
Grow/Similar
Both of these commands will expand your selection based on colour. Grow will include adjacent pixels which have similar coour values. Similar does exactly the same but with pixels which can be anywhere in the active layer.
Transform Selection
When selected, a bounding box with draggable handles is displayed around your selection. The handles can be dragged to stretch, squash or resize your selection. This can be very useful for aligning a straight line selection to the side of a building for example. Zoom in to the handles to get a very precise result.
Invert a Selection
It is often the case that you will make a selection by selecting the areas you DON’T want to include. For example, if you want to create a selection of everything except reddish colours, you may find it easier to select these reddish colours and then invert your selection.
This can be done by right-clicking anywhere on the image and choosing ‘Select Inverse’ from the dropdown, by clicking the Invert button in the Select and Mask dialogue or by pressing SHIFT CTRL I.
Clear a selection
The easiest way to deselect is to press CTRL D. You can probably guess the other ways to get the same result.
Step 2: Saving Selections as Masks
Once you are happy with your selection, it can be saved as mask. Although masked areas can be edited immediately, it nearly always makes more sense to save them so they can be edited further or re-used. There are two main methods for saving masks:
Method 1
Go to Select Menu >> Save Selection. In the dialogue which opens, make sure ‘New’ is selected. Then give your mask a meaningful name and click OK.
Method 2
This requires the use of the Channels panel. This is where any masks you have created are stored. Every image will have 4 visible channels when it is opened; the combined RGB channel and one for each of the 3 RGB colours. Channels which you save are referred to as alpha channels and will appear below the 4 visible channels.
In this example, 3 alpha channels or masks have been created; one for each of the 3 coloured circles in the image below. Alpha channels are always shown in black and white. The white area shows where your mask is and indicates the area which can be adjusted when the mask is applied. The black area will be protected from any adjustments.
Once you have created your selection , click the ‘Save Selection as Channel’ icon. It’s a good idea to rename your channel to something meaningful.
Masks can be created and saved at any point in the editing process.
Using Masks
A saved mask can be reloaded at any time by going to Select Menu >> Load Selection. Alternatively you can use the Channels panel. Either hold down CTRL and click on the mask you wish to load or select the alpha mask and click, ‘Load Channel as Selection’.
It’s also possible to combine several masks using the Channels panel:
- CTRL click on any alpha mask to create a new selection.
- SHIFT CTRL click on a second mask to add that to the selection.
- CTRL ALT click on a second mask to subtract the second mask from the selection .
- SHIFT CTRL ALT click on a second mask to intersect the two masks.
Once the mask is loaded as a selection, the relevant layer can be edited and only the masked areas will be adjusted.
Masks work best when they are combined with layers, often using Layer Masks. This is described in detail in Module 8: Using Layers and Masks.