163. Mask an Image Layer
Before You Begin
91 About Layers and the Layers Palette
100 Make an Adjustment or Fill Layer
164 Replace a Background with Something Else
166 Frame a Photograph
169 Create a Composite Image
As you learned in 91 About Layers and the Layers Palette, a mask blocks data on a layer from covering up data on the layers below it. Masks are automatically created when you insert an adjustment or fill layer. For an adjustment layer, the mask blocks the adjustment from affecting certain areas of the layers below. For a fill layer, the mask simply blocks the fill from appearing in particular areas of the layers below.
But what do you do if you want to mask an image layer rather than an adjustment or fill layer? For example, suppose you want a flag to appear within the contours of an American eagle? You could use the Cookie Cutter tool to cut the flag into an eagle shape (if it had an eagle shape to use, which it doesn't). But even if the Cookie Cutter tool had the shape you wanted, you couldn't reposition the flag image within the eagle shape after committing the change. The simplest way to create what you want is to use a clipping mask in the shape of an eagle to control what portions of the flag appear in the final image. Unlike an adjustment or fill mask, in which black is used to block data and white is used to allow data on upper layers to show through, in a clipping mask, opaque pixels (regardless of their color) allow data to show through, and transparent or partially transparent pixels block data fully or partially.
Clipping mask Controls what portions of any upper layers grouped with the mask appear in the final image.
Add Clipping Mask Layer
Open the image you want to mask in the Editor in Standard Edit mode and save it in Photoshop (*.psd) format. Insert a new layer for the mask by clicking the Create new layer button on the Layers palette, or choosing Layer, New, Layer from the menu bar. Name this new layer Clipping Mask.
The Clipping Mask layer must go beneath the layer(s) you want to mask. So, if necessary, in the Layers palette, drag the Clipping Mask layer into position under the layer you want to mask.
If you need to position the Clipping Mask layer below the Background layer, you must first convert the Background layer to a regular layer. In the Layers palette, click the Background layer and choose Layer, New, Layer from Background. In the New Layer dialog box that appears, you can name the converted layer Image if you like, so you'll remember what it contains.
Create the Mask
On the Layers palette, select the Clipping Mask layer. To create a mask on this layer in the shape you want, you have the following choice of methods:
Paint on the Clipping Mask layer with any color using the Brush tool, or draw with the Pencil. To create a feathered effect, select a soft brush to apply semi-transparent pixels to allow the upper layers to show partially through. Remember: Where you paint or draw, that portion of the image layer will show through in the final image. See 115 Draw on a Photo with a Pencil and 117 Paint an Area of a Photo with a Brush.
Draw any shape you want onto the Clipping Mask layer, using any of the shape tools, such as the Rectangle tool or the Custom Shape tool. If you want more than one shape on the Clipping Mask layer, or if you want to create an object with a complex shape made up of several different shapes (such as a rectangle and two circles), draw your shapes with the Add to shape area button enabled on the Options bar. Again, the portion of the image layer that appears in the final image will be in the shape you draw. See 120 About Drawing Shapes.
To help you position and size the clipping mask, lower the Opacity of the Image layer. After creating the clipping mask, move and resize it using the Move tool. See 99 Move, Resize, Skew, or Distort a Layer.
Fill the layer with a gradient, using the Gradient tool. The upper layers will be blocked only where the gradient is fully transparent, will show through partially where the gradient is partially opaque, and will show through fully where the gradient uses fully opaque pixels, so keep that in mind when selecting a gradient preset. See 119 Fill an Area with a Gradient. In a similar manner, you can fill the Clipping Mask layer with a pattern. See 118 Fill an Area with a Pattern.
Use the Selection Brush to create a selection in the shape you need; fill the selection with any color using the Paint Bucket tool. The image layer will show through only in the area you fill. If you feather the edges of the selection, the upper layers will show through at the edges, but only partially. This might enable you to blend the masked area more smoothly into the layers below. See 77 Paint a Selection.
Type text, and then merge the text layer into the Clipping Mask layer by selecting the text layer in the Layers palette and choosing Layer, Merge Down. The upper masked layer(s) will then appear only within the outline of the text. See 183 Add a Text Caption or Label.
You can create a Clipping Mask layer using any of the selection tools to select an object in another image that's in the shape you want to use and copying that object into your image, to a new layer below the image layer you want to clip. This process saves you from having to create a Clipping Mask layer manually because pasting data from a different image always results in a new layer. Skip the step here that creates a Clipping Mask layer, remove the Clipping Mask layer if you've already created one, or merge the layer you pasted into the image with the Clipping Mask layer so that there's just one layer. See 70 About Making Selections.
Create a Clipping Group
In the Layers palette, choose the Image layer and, if needed, return it to full opacity. Group this layer with the Clipping Mask layer by choosing Layer, Group with Previous. On the Layers palette, the Image layer is indented, indicating that the upper layer is being clipped (masked) by the layer below. Data on the Image layer is now masked by the Clipping Mask layer and shows through only where the Clipping Mask layer is partially or entirely opaque.
You've just created a clipping group. Now, if you'd like to clip other layers as well, you can add the layer just above the Image layer to the clipping groupthere cannot be any other layers in between. In the Layers palette, select the layer above the Image layer and choose Layers, Group with Previous to group the layer with the clipping group. In this same manner, add as many other layers as you like to the clipping group.
View the Result
After you're satisfied with the result, make any other changes you want and then save the PSD file. Resave the result in JPEG or TIFF format, leaving your PSD image with its layers intact so that you can return at a later time and make different adjustments if you like.
To create this image, I used the shape of an eagle to mask two layersone of my sister's family enjoying the Fourth of July on their pontoon boat, and another layer of an American flag. I blended these two layers together so that you can just see the ripple of the flag across the family photo, and the result was clipped by the eagle mask. On the bottom layer, I placed an image of the fireworks we enjoyed later that evening. By placing the fireworks layer on the bottom, its contents are obstructed by only the portion of the image layer that's clipped by the mask. Look for this image in the Color Gallery.