How masks are associated with alpha channels in Photoshop

When you select part of an image, the area that is not selected is masked, or protected from editing. When you create a mask, you isolate areas of an image as you apply color changes, filters, or other effects to the rest of the image. You can also use masks for complex image editing such as gradually applying color or filter effects to an image.

You can add a mask to a layer and use the mask to hide portions of the layer and reveal the layers below. By default, the layer mask is linked to the layer that it is attached to.

To save a selection more permanently, you can store it as an alpha channel. The alpha channel stores the selection as an editable grayscale mask in the Channels panel. Once stored as an alpha channel, you can reload the selection at any time or even load it into another image. Masks are stored in alpha channels. Masks and channels are grayscale images, so you can edit them like any other image with painting tools, editing tools, and filters. Areas painted black on a mask are protected, and areas painted white are editable.

If you want to directly edit layer transparency, create a mask for this data.

In the Layers panel, select the layer.

Choose Layer > Layer Mask > From Transparency.

You can Shift-click the thumbnail to disable it and make the image and its channels opaque.

Photoshop converts transparency into an opaque color, hidden by the newly created mask. The opaque color varies greatly, depending upon the filters and other processing previously applied to the layer.

Photoshop channels

Channels are grayscale images that store different types of information:

Color information channels are created automatically when you open a new image. The image’s color mode determines the number of color channels created. For example, an RGB image has a channel for each color (red, green, and blue) plus a composite channel used for editing the image.

Alpha channels store selections as grayscale images. You can add alpha channels to create and store masks, which let you manipulate or protect parts of an image. (See About masks and alpha channels.)

An image can have up to 56 channels. All new channels have the same dimensions and number of pixels as the original image. With an RGB image, which has three color channels (red, green, and blue), and a composite (RGB) channel, you can add up to 20 additional alpha channels.

The file size required for a channel depends on the pixel information in the channel. Certain file formats, including TIFF and Photoshop formats, compress channel information and can save space. The size of an uncompressed file, including alpha channels and layers, appears as the rightmost value in the status bar at the bottom of the window when you choose Document Sizes from the pop‑up menu.

Note: As long as you save a file in a format supporting the image’s color mode, the color channels are preserved. Alpha channels are preserved only when you save a file in Photoshop, PDF, TIFF, PSB, or raw formats. DCS 2.0 format preserves only spot channels. Saving in other formats can discard channel information.

Transparency and alpha channels and png

PNG does not support arbitrary alpha channels like other formats such as TIFF. PNG specifies that the fourth channel in a file is transparency, and only transparency. When you open a PNG file with transparency in Photoshop, it is considered a single layer image. It is not a flat background image. Alpha channels can contain anything, while transparency is a specific channel relationship. You can have multiple alpha channels per document, but only one transparency channel. Photoshop handles transparency and alpha channels separately. Transparency from an existing PNG can be edited in Photoshop by creating a layer mask from the transparency data (see steps below).

If you want to see the opacity of a given point in an image file, follow these steps:

Open the Info palette.

Click the palette option in the upper-right corner and choose Panel Options.

Where it says "Second Color Readout," choose Mode: Opacity.

Click OK.

The info palette provides the opacity level at the location of the mouse.

If you want to directly edit layer transparency, it is possible to create a layer mask based on the layer transparency.

In the Layers panel, select the layer.

Choose Layer > Layer Mask > From Transparency.

You see a layer mask thumbnail that is linked to the original layer. You can Shift-click on the thumbnail to disable it and make the image and its channels opaque. Clicking the thumbnail again reenables it.

Masks are stored in alpha channels. In the channels panel, you should see a Layer 0 Mask. Hide the color channels and make the Layer 0 Mask visible by clicking the eye icon to see the mask. Masks and channels are grayscale images, so you can edit them like any other image with painting tools, editing tools, and filters. Areas painted black on a mask are protected, and areas painted white are editable.

If you save the file as a PNG, and then reopen the PNG in Photoshop, the transparency is implicit. You don't see a layer mask thumbnail or a mask stored in an alpha channel.

Select the nontransparent areas a layer in Photoshop

You can select all the non-transparent areas on a layer, or, if a layer mask exists, all the unmasked areas. Selecting these areas is useful when you want to select image content that is surrounded with or contains transparent areas, or to create a selection that excludes masked areas on a layer.

1. Do one of the following:

To select only the non-transparent areas on an unmasked layer, Ctrl-click (Windows) or Command-click (Mac OS X) the layer thumbnail in the Layers panel.

To select the unmasked areas on a layer that has a layer mask, Ctrl-click (Windows) or Command-click (Mac OS X) the layer mask thumbnail in the Layers panel.

2. If a selection exists, you can do any of the following:

To add the pixels to an existing selection, press Ctrl+Shift (Windows) or Command+Shift (Mac OS), and click the layer thumbnail or layer mask thumbnail in the Layers panel.

To subtract the pixels from an existing selection, press Ctrl+Alt (Windows) or Command+Option (Mac OS), and click the layer thumbnail or layer mask thumbnail in the Layers panel.

To load the intersection of the pixels and an existing selection, press Ctrl+Alt+Shift (Windows) or Command+Option+Shift (Mac OS), and click the layer thumbnail or layer mask thumbnail in the Layers panel.

Create an alpha channel from a selection

Use a selection tool to select the area or areas of the image you want to isolate.

Choose Select > Save Selection.

Specify the following in the Save Selection dialog box, and click OK:

Document
Chooses a destination image for the selection. By default, the selection is placed in a channel in your active image. You can choose to save the selection to a channel in another open image with the same pixel dimensions or to a new image.

Channel
Chooses a destination channel for the selection. By default, the selection is saved in a new channel. You can choose to save the selection to any existing channel in the selected image or to a layer mask if the image contains layers.

If you’re saving the selection as a new channel, type a name for the channel in the Name text box.

If you’re saving the selection to an existing channel, select how to combine the selections:

Replace ChannelReplaces the current selection in the channel.

Add to ChannelAdds the selection to the current channel contents.

Subtract From ChannelDeletes the selection from the channel contents.

Intersect With ChannelKeeps the areas of the new selection that intersect with the channel contents.

You can select the channel from the Channels panel to see the saved selection displayed in grayscale.

Determine if a channel is an alpha channel in Photoshop

If you double-click the channel, it brings up the channel options dialog window. The dialog window indicates if the color indicates "masked areas," "selected areas," or "spot color."

Create an alpha channel from a selection

Use a selection tool to select the area or areas of the image you want to isolate.

2. Choose Select > Save Selection.

3. Specify the following in the Save Selection dialog box, and click OK:

Document
Chooses a destination image for the selection. By default, the selection is placed in a channel in your active image. You can choose to save the selection to a channel in another open image with the same pixel dimensions or to a new image.

Channel
Chooses a destination channel for the selection. By default, the selection is saved in a new channel. You can choose to save the selection to any existing channel in the selected image or to a layer mask if the image contains layers.

If you’re saving the selection as a new channel, type a name for the channel in the Name text box.

If you’re saving the selection to an existing channel, select how to combine the selections:

Replace Channel
Replaces the current selection in the channel.

Add to Channel
Adds the selection to the current channel contents.

Subtract From Channel
Deletes the selection from the channel contents.

Intersect With Channel
Keeps the areas of the new selection that intersect with the channel contents.

You can select the channel from the Channels panel to see the saved selection displayed in grayscale.

How Photoshop displays transparency properties of images

If an image contains a clipping path, the clipping path is displayed in the Photoshop “Paths” window with its name displayed in bold font.

If an image contains an alpha or mask channel, the extra channel is displayed in the “Channels” window. Every channel in the “Channels” window has an icon of the current image. If you double-click this icon, nothing happens for process colors, but a “Channel Options” window is opened for masked, alpha, and spot channels. This “Channel Options” window displays properties of extra channels.

If an image contains a transparency channel, it is NOT displayed in the “Channels” window. Instead, the “Layers” window contains exactly one layer entry (displayed in non-italic font) and no background layer entry.

If an image contains multiple layers, the “Layers” window contains more than one layer entry.

Techniques used to create transparency in raster images

There are several different techniques to create transparency in raster images:

Clipping paths

Alpha and mask channels

Transparency channels

Multiple layers

Clipping paths

The most common way of creating transparency in prepress production uses clipping paths. Clipping paths isolate foreground objects and make their background transparent. Clipping paths are vector-based line structures which create hard edges between foreground objects and transparent background.

Alpha and mask channels

Some image formats support alpha or mask channels.

In all raster images each pixel is represented by a set of numerical values for all colorants of the image, depending on its color space. If an image contains an alpha channel, each image pixel is represented additionally by a numerical value which specifies the opacity of that pixel. In alpha channels, 100% specifies an opaque pixel and 0% specifies a transparent pixel. Mask channels are exactly like alpha channels except for their polarity. In mask channels, 100% specifies a transparent pixel and 0% specifies an opaque pixel. Alpha and mask channels offer multilevel transparency for drop shadows and soft edges of objects, also known as feather effects. If an image format supports alpha and mask channels, any image of that format may contain zero, one or multiple alpha or mask channels. The extra channels can be identified by their unique names. If an image contains one or more alpha or mask channels, the user has the option to apply none of the extra channels or exactly one of them.

Transparency channels

Transparency channels are much like alpha channels. Raster image formats supporting transparency channels can contain exactly one or no transparency channel. The user usually does not have the choice whether to apply the transparency channel or not. The application of a transparency channel is mandatory. Each image pixel is represented by a set of numerical values for the visible colorants and one additional numerical value containing the opacity information. 100% specifies an opaque pixel and 0% specifies a transparent pixel. Transparency channels offer multilevel transparency, too. A well-known example of an image format with transparency channels is PNG with RGBA color.

Multiple layers

The most complex way of creating transparency currently is to combine multiple layers in Adobe Photoshop. Only TIFF and Photoshop native documents support multiple layers. TIFF images always contain a main image which is a combination of all Photoshop layers. But Photoshop native images contain a main image which is not necessarily a combination of all Photoshop layers.

Glossary

layer mask

A layer mask is a transparency mask that is attached to the layer. It only appears in the alpha channel if the layer is active.

unassociated alpha channel

RGB images with alpha transparency can be stored in two different ways. One way is to store raw RGB values and alpha values as separate and independent channels; this is called "unassociated alpha". PNG standardized on "unassociated" ("non-premultiplied") alpha so that images with separate transparency masks can be stored losslessly. Most image-processing programs stores images with unassociated alpha, to be able to manipulate RGB and alpha independently of one another, and not lose RGB data when zeroing out alpha.

pre-multiplied alpha channel

Another way is to store RGB values not raw, but premultiplied by corresponding alpha value, which is then called "associated alpha".
If an alpha channel is used in an image, it is common to also multiply the color by the alpha value. This is usually referred to as premultiplied alpha. "Premultiplied alpha", stores pixel values premultiplied by the alpha fraction. The alpha information of a pixel is not only stored in the alpha channel itself, but it is already "multiplied" into the red, green, and blue channel. Rendering software prefers associated alpha, because with RGB values already multiplied by alpha, less work remains to be done in real time when doing alpha blending. TIFF support both types of alpha, but are frequently mislabeled.

Twitter™ and Facebook posts are not covered under the terms of Creative Commons.