Photoshop Tutorials - Layer Masks
You have already noticed the drawbacks of placing the objects on the layer by simply removing the background. If the background is removed you cannot return it and cannot correct the mistakes made during the selection. You can overcome this obstacle by using the Layer Mask. Every layer can have one and only mask. It determines which areas of the layer are visible and which are transparent.
The black area of the mask makes the pixels underneath it become transparent. Mask of the white color preserves the pixels of the image as they are. Grey areas are semi-transparent. Pixels that are transparent under the Layer Mask are not lost, you can restore them editing the mask.
We will create one more collage of two images but this time we will not be removing the background for the object in the first image that we plan to place at the image 2. We will use the Layer Mask:
Open the Image 2 that will be the background for the object from the Image 1. Turn Image 2 into regular layer from the background layer by double-clicking it.
Open Image 2 with some object you want to copy on the monochromatic background or background with similar colors. Open it as a new layer that is over the Image 1 layer.
Use Magic Wand tool to select the monochromatic background and then invert the selection (Select > Inverse).
Click Add Layer Mask icon in the Layers panel. What is covered with Black in the mask will become transparent.
Now the object from the Image 1 is smoothly placed over the Image 2. That is how the Layer Mask work.
There is the Add Layer submenu in the Layer menu that has a set of commands for adding a layer mask for an active layer:
Reveal All - a solid white layer mask will be created (that is similar to Select All for the image) revealing everything and in order to hide something you will need to edit the layer mask with black color.
Hide All - A solid black mask will be created hiding the layer completely and you can reveal desired areas of the layer painting respective mask areas in white.
Reveal Selection - This command is available only when you have made a selection. The selection will be filled with white on the layer mask and the rest will be filled with black, making the selected are visible.
Hide Selection - This command is available only when you have made a selection. The selection will be filled with black on the layer mask and the rest will be filled with white, making the selection invisible.
The thumbnail preview of the Layer Mask is shown in the Layers palette beside the thumbnail of the layer image.
Now let us check how Layer and Mask are linked.
Open the Channels palette. The Layer Mask is displayed there as a regular alpha-channel. Its name is formed by adding the Mask word to the layer name.
Click the eye icon to see its contents in the document window. The mask covers the dark areas of the image. Masked areas of the layer are transparent as you could already see creating the layer mask.
Make the mask channel invisible and move to the layers palette. Pay attention to the link icon between the layer and layer mask thumbnails. This means that any transform or move operations will be applied to both layer and mask.
If you do not want the layer and mask to be linked you can click the link icon between them to remove the linking.
The Layer Mask can be disabled. In order to do this press Shift and click on the mask thumbnail in the Layers palette. To enable the layer mask click on its thumbnail again having Shift button pressed. You can also do this by going to Layer > Disable Layer Mask, but that would be the slowest way to do so.
The Layer mask can be edited. You can do this by selecting it in the Channels palette or you can click on it in the Layers palette with Alt button pressed.
To remove the Layer Mask you can go to Layer > Remove Layer Mask or simply drag the thumbnail of the mask to the trash bin in the Layers or Channels palettes. After any of these actions, Photoshop will prompt you whether to Apply or Discard the mask before deleting it. If the mask is applied then transparent areas will be deleted and the ones that are visible will be saved over the transparent background. Discard option will save the layer that is underneath the mask as it is.