Photoshop Masks and Channels

Photoshop masks and channels are the keys to developing complex compositions.

Layer Masks

Download the Source Files

Layer masks let you non-destructively erase areas from one layer to reveal the layers below. Non-destructively means you are not actually destroying pixels. You can always move things around and change how photos are combined later, because they are still in one piece.

Layer masks are one of the most important things you can learn when it comes to Photoshop layers. Once you figure them out, you’ll wonder how you ever got along without them.

Start by downloading the ZIP file above and extracting the files.

Careful Where You Paint!

It matters where you click on a layer with a mask before you paint. If you click on the layer’s image thumbnail, you will paint directly onto the image. If you click on the layer mask thumbnail first, you will paint on the layer mask.

  1. Open two photos: niece.jpg and nephew.jpg
  2. Use the Move tool to add nephew.jpg to neice.jpg.
  3. Add a layer mask to the top layer (the one with my nephew in it).
  4. Save the file as careful.psd.
careful painting 1
  1. Take a closer look at the top layer (the one with the mask). Notice how there are two thumbnails on the layer? One is the actual layer thumbnail that gives you a little preview of what is one that layer. The other is the layer mask.
careful painting 2
  1. Click on the layer thumbnail to select it: the thumbnail on the left. You’ll see a small black outline around the corners of the thumbnail.
  2. Get the Brush tool and paint with black onto your image. You should see black painted directly onto the photo of my nephew.
careful painting 3
  1. Undo the black brush stroke(s) in the History palette.
  2. This time, click on the layer mask thumbnail instead.
  3. Now paint with black on the image.
  4. You should see my neice revealed underneath rather than black paint.
careful painting 4
  1. Save the file and close it.

Layer Masks Basics

  1. Open two photos: super-spy.jpg and gun-barrel.jpg.
Photoshop Masks and Channels: layer mask basics 1
  1. Use the Move tool to drag the gun barrel image onto the image of the super spy.
Photoshop Masks and Channels: layer mask basics 2
  1. Save the file as basics.psd.
  2. Time to add a layer mask to the gun barrel layer. Make sure Layer 1 is selected, then click on the Add Layer Mask button at the bottom of the layers palette. It looks like a gray rectangle with a white circle inside it.
Photoshop Masks and Channels: layer mask basics 3

The layer mask thumbnail shows up right next to the image thumbnail on the layer. The layer mask starts out as solid white, allowing the entire gun barrel layer to remain visible. In order to hide part of this layer, we need to fill part of the layer mask in black. We’re going to show the super spy through the end of the gun barrel, so we need to select the area and fill it with black on the mask.

  1. Select the Elliptical Marquee tool and draw a circular selection in the middle of the canvas. (Remember to hold the shift key down to keep the selection perfectly circular.)
Photoshop Masks and Channels: layer mask basics 4
  1. Fill the selection with black:
    1. Edit > Fill
    2. In the Use dropdown, select Black.
    3. Ctrl+D to deselect.
  2. Notice in the Layers palette that the gun barrel layer is still intact, but that a portion of it is hidden because of the black part of the mask.
    1. Wherever there is white on a mask, that layer is still visible.
    2. Wherever there is black on a layer mask, the layer(s) below are visible and the current layer is hidden.
  3. Save the file and close it.
Photoshop Masks and Channels: layer masks basics 5

Automatically Creating Layer Masks

You can automatically create layer masks by making a simple selection and using Paste Into. Here we’ll replace the image in a cool dude’s sunglasses with a sunset image of airplanes.

  1. Open two photos: cool-dude.jpg and airplanes.jpg.
Photoshop Masks and Channels: automatically creating layer masks 1

Start with the photo you want to use as the replacement area. In this example, we’re using the photo of the airplanes.

  1. Select the entire image of airplanes.jpg using Ctrl+A. Then copy the image with Ctrl+C.
Photoshop Masks and Channels: automatically creating layer masks 2
  1. Now switch over to the photo of the cool dude. Use the Quick Selection tool to select the areas inside this sunglass lenses:
    1. Use the Zoom tool tool to zoom into the sunglasses.
    2. Select the Quick Selection tool.
    3. Click the “Add to Selection” icon on the Options bar.
    4. Click and drag the Quick Selection tool across the left-hand lens.
    5. Drag the same tool across the right-hand lens.
    6. If the selections spill over onto the face or the frames, press-and-hold the Alt key and click on those areas to subtract them from the selection. Make the brush size smaller to make small corrections.
automatically creating layer masks 3
  1. Choose Paste Into from the Edit menu. It will paste the airplanes image into the active selection: the dude’s sunglass lenses. It makes sure the airplane photo only shows in the lenses by automatically creating a layer mask for this new layer.
automatically creating layer masks 4
  1. Save the file as pasteinto.psd.
  2. Here’s where it gets really cool. Select the Move tool. Click and drag the photo of the airplanes around. Find a good location for the planes in the sunglass reflections.
automatically creating layer masks 5
  1. Now let’s resize and warp the planes to simulate the curve of the lenses:
    1. With the airplane layer still selected in the Layers palette, press Ctrl+T to transform the image.
    2. Make the image smaller by holding shift while you drag one of the corner handles in a bit.
    3. Right-click inside the transform box and select Warp.
    4. In the Options bar, select Inflate from the Warp drop-down menu.
    5. Press Enter to save the transformation.
automatically creating layer masks 6
  1. Drop the opacity of the airplane photo layer the better blend in with the glasses: in the Layers palette, change the Opacity to 80%.
  2. Save the file and close it.
automatically creating layer masks 6

Combining Multiple Images

  1. Open three photos: buildings.jpg, fork.jpg and running-man.jpg.
combining images 1
  1. Use the Move tool to move the buildings onto the top half of the running man image.
  2. Save the file as combining.psd.
combining images 2
  1. Make sure the buildings layer is selected, then click on the Add Layer Mask icon at the bottom of the Layers palette to add a layer mask to it.
combining images 3

Now we’ll add a gradient to the layer mask that will blend the edge of the building image into the man.

  1. Select the Gradient tool from to Toolbox.
  2. In the Option Bar, click on the gradient dropdown and select the third gradeint (Black, White).
combining images 4
  1. We’re going to use the gradient on the layer mask. Click on the layermask thumbnail in the Layers palette.
  2. Click on the bottom of the buildings and drag up a little ways (hold the Shift key down to keep your angle straight up.) If the man’s head is not visible, try drawing the gradient again.
combining images 5
  1. Let’s bring in the third image. Use the Move tool to bring the fork image into combining.psd, and make sure it is at the top of the layer stack.
combining images 6
  1. Add a layer mask to this layer as well.
  2. The fork shape needs a little more care to blend it in. Select the Brush tool.
  3. In the Options bar, set the Diameter to 200 pixels and the Hardness to 0% to get a large, soft brush.
  4. Click once on the layer mask for the fork layer.
  5. Press D, the X to set your Foreground color to black.
  6. Paint around the fork to hide the areas next to it. Paint over the man to reveal him.
combining images 7
  1. If you paint out too much of the fork image, press X to switch back to white. Then paint on the layer mask to reveal portions of the fork layer. Feel free the change to brush size.
combining images 8
  1. Save the file and close it.

With a bit of text, the image resembles the collaging technique used in many movie posters. You don’t need to do this today, however.

combining images 9

Advanced Compositing

Download the Source Files

Layer masks aren’t just for collaging and blending photos. They’re actually a very powerful selection and design tool.

We’ll work on a Web site design with a lot of visual impact. You will use the shape of one layer to create the mask for another. We’ll create the illusion that the skier is breaking right out of an LCD screen.

Start by downloading the ZIP file above and extracting the files.

  1. Open three images: skier.jpgmonitor.jpg and mountains.jpg.
advanced compositing 1
  1. Start with the photo of the skier.
  2. Open the Color Range command: Select > Color Range.
    1. In the Color Range dialog, make sure that the preview is set to Selection.
    2. Click on the photo near the top part of the sky.
    3. Press the Shift key and click on other areas of the sky until the entire sky area is white in the preview.
    4. Set the Fuzziness slide to 160.
    5. Click OK.
advanced compositing 2
  1. Now the sky is selected. We want the skier selected, so go to Select > Inverse.
  2. Press Ctrl+J to copy the skier by herself to a new layer.
  3. Save this file as skier.psd.
advanced compositing 3
  1. Time to move both of the layers over to the LCD screen. Click on one of the layers in skier.psd, then hold Ctrl down and click on the other layer.
  2. Drag these layers over into monitor.jpg. Aim for inside the LCD screen.
advanced compositing 4 advanced compositing 5
  1. Save this file as web-mockup.psd.
  2. Click on the eye icons in front of the two skier layers to hide them, so we can see the LCD again.
  3. Select the Polygonal Lasso tool from the Toolbox, and make a rectangular selection of the LCD screen.
advanced compositing 6
  1. Unhide the skier layers (don’t deselect yet.)
  2. Click on the bottom skier layer (the one with the enitre photo on it) and click on the Add Layer Mask icon at the bottom of the Layers palette. Photoshop automatically hides everything on this layer that extends past the rectangular selection you drew.
advanced compositing 7
  1. Now we want to apply the same layer mask to the top skier layer. But we don’t have to draw our selection agin. Press-and-hold the Alt key, then click-and-drag the layer mask from one skier layer to another.
advanced compositing 8
  1. Save the file.
  2. We have a layer mask on Layer 2 (the top skier image) but right now we really need to see just the image again while leaving the layer mask in place. We want to position her skis so they break out past the screen bottom, and her head so it breaks out of the top edge:
    1. Hold Shift down and click on the Layer Mask thumbnail for Layer 2 to temporarily diable the mask.
    2. Before we move the layer, click on the little link icon that appears between the layer thumbnail and the layer mask thumbnail to unlink them. Do the same for Layer 1 below it. This allows us to move the images while keeping the screen outline in place.
    3. Make sure Layer 1 is still selected. Ctrl-click on the words “Layer 2” to select both at the same time.
    4. Use the move tool to reposition the skier image so her head and skis pop out of the screen.
advanced compositing 9
    1. Relink the layer masks to the layers.
    2. Click on Layer 2’s layer mask thumbnail to turn it back on.
  1. Now take a look at the layer thumbnail for Layer 2. We need to change the layer mask so the her head and skis are visible. This will require painting white on the mask:
    1. Select the Brush tool.
    2. Set the Foreground color to white.
    3. Make sure that Layer 2’s layer mask is still selected.
    4. Paint aroung the skier’s head until is is all revealed.
    5. Paint around the ski tips until they are revealed along with some snow spray.
    6. Paint back some snow spray of the right side of the screen.
advanced compositing 10
  1. The snow that’s bursting out of the screen has some blue outlines because it was selected from a blue sky. Let’s fix it:
    1. Zoom in to the snow spray.
    2. Select the Dodge tool (the one that looks like a sucker) from the Tool box.
    3. In the Options bar, set Range to Midtones and Exposure to 50%.
    4. Click on the layer thumbnail (not the layer mask) for Layer 2.
    5. Paint the snow spray with the Dodge tool.
    6. Stay away from the image inside the LCD screen.
advanced compositing 11
  1. Save the file.
  2. Bring mountains.jpg up front.
  3. Select the Rectangular Marquee tool and make a large selection which spans across the horizon and includes some sky and tree tops.
  4. To get rounded corners, go to Select > Modify > Smooth. Enter 20 pixels for the Sample Radius, and click OK.
advanced compositing 12
  1. Select the Move tool and move this selection into web-mockup.psd. Position it near the top of the overall image but leave some room around it.
advanced compositing 13
  1. Move the new layer, Layer 3, down below the two skier layers in the stack.
  2. With Layer 3 still selected, add a white stroke around it:
    1. Edit > Stroke.
    2. Change the Width to 2 and the color to white, then click OK.
advanced compositing 14
  1. There’s still a bit of the monitor frame being hidden behind the mountains. Let’s fix that:
    1. Hide the mountains layer (Layer 3) so we can see the monitor corner.
    2. Select the Polygonal Lasso tool.
    3. Make a selection around the outside edges of the monitor (you don’t need to include the stand.)
advanced compositing 15
    1. Inverse the selection (Select > Inverse).
    2. Turn the mountains layer back on and make sure it is still selected.
    3. Click the Add Layer Mask icon at the bottom of the Layers palette.
advanced compositing 16
  1. You’ll notice that the white stroke carries around the edge of the monitor. To fix this:
    1. Double-click on Effects under Layer 3.
    2. Click the check box next to Layer Mask Hides Effects to select it.
      Photoshop Layer Styles: Layer Mask hides Effects
    3. Click OK.
  2. Save the file.

This would be a great beginning to a Web mockup, ready for client review. Here I’ve added some navigation:

advanced compositing 17

Demo: Using Channels to Make Selections

Click for the big version:

Photoshop Masks and Channels - using channels to make selections

 

Channels Topics

  • channels for RGB, CMYK, and Grayscale
  • saving selections as alpha channels: Select > Save Selection, and save to a new channel
  • duplicating channels to create alpha channels: drag to New Channel icon at the bottom of the Channels panel
  • editing alpha channels
    • invert (Cmd+I on Mac, Ctrl+I) to swap black and white
    • use Levels (Image > Adjustments > Levels) to make blacks deeper and whites whiter
    • paint white inside everywhere you need to keep in the selection (e.g. her face and shoulder)
  • creating selections from alpha channels: cmd+click (Mac) or ctrl+click (PC) on the channel thumbnail