AfterEffects

Linear Color Key effect

Linear keys create a range of transparency across an image. A linear key compares each pixel in the image to the key color you specify. If the color of a pixel closely matches the key color, it becomes completely transparent. Pixels that don’t match as well are made less transparent, and pixels that don’t match at all remain opaque. The range of transparency values, therefore, forms a linear progression.

The Linear Color Key effect uses RGB, hue, or chroma information to create transparency from a specified key color.

This effect works with 8-bpc, 16-bpc, and 32-bpc color.

Apply the Linear Color Key effect

In the Effect Controls panel, the Linear Color Key effect displays two thumbnail images; the left thumbnail image represents the unaltered source image, and the right thumbnail image represents the view you’ve selected in the View menu.

You can adjust the key color, the matching tolerance, and the matching softness. The matching tolerance specifies how closely pixels must match the key color before they start becoming transparent. The matching softness controls the softness of edges between the image and the key color.

You can also reapply this key to preserve a color that was made transparent by the first application of the key. For example, if you key out a medium-blue screen, you might lose some or all of a light-blue piece of clothing your subject is wearing. You can bring back the light-blue color by applying another instance of the Linear Color Key and choosing Keep This Color from the Key Operation menu.

  1. Select a layer as the source layer, and then choose Effect > Keying > Linear Color Key.
  2. In the Effect Controls panel, choose Key Colors from the Key Operation menu.
  3. Choose a color space from the Match Colors menu. In most cases, use the default RGB setting. If you have trouble isolating the subject using one color space, try using a different color space.
  4. In the Effect Controls panel, choose Final Output from the View menu. The view you choose appears in the right thumbnail and in the Composition panel. If you need to see other results, work in one of the other views:
    Source Only
    Shows the original image without the key applied.

    Matte Only
    Shows the alpha channel matte. Use this view to check for holes in the transparency. To fill undesired holes after you complete the keying process, see Close a hole in a matte.

  5. Select a key color in one of the following ways:
    • Select the Thumbnail eyedropper, and then click an appropriate area in the Composition panel or the original thumbnail image.

    • Select the Key Color eyedropper, and then click an appropriate area in the Composition or Layer panel.

    • To preview transparency for different colors, select the Key Color eyedropper, hold down the Alt key (Windows) or Option key (Mac OS), and move the cursor to different areas in the Composition panel or the original thumbnail image. The transparency of the image in the Composition panel changes as you move the cursor over different colors or shades. Click to select the color.

    • Click the Key Color swatch to select a color from the specified color space. The selected color becomes transparent.

      Note: The eyedropper tools move the sliders accordingly. Use the sliders in steps 6 and 7 to fine-tune the keying results. To use eyedroppers in the Layer panel, choose Linear Color Key from the View menu in the Layer panel.
  6. Adjust matching tolerance in one of the following ways:
    • Select the Plus (+) or the Minus (-) eyedropper, and then click a color in the left thumbnail image. The Plus eyedropper adds the specified color to the key color range, increasing the matching tolerance and the level of transparency. The Minus eyedropper subtracts the specified color from the key color range, decreasing the matching tolerance and the level of transparency.

    • Drag the matching tolerance slider. A value of 0 makes the entire image opaque; a value of 100 makes the entire image transparent.

  7. Drag the Matching Softness slider to soften the matching tolerance by tapering the tolerance value. Typically, values under 20% produce the best results.
  8. Before closing the Effect Controls panel, make sure to select Final Output from the View menu to ensure that After Effects renders the transparency.

Preserve a color after applying Linear Color Key

  1. In the Effect Controls panel or Timeline panel, turn off any current instances of keys or matte effects by deselecting the Effect option to the left of the key name or tool name. Deselecting the option causes the original image to appear in the Composition panel so that you can select a color to preserve.
  2. Choose Effect > Keying > Linear Color Key. A second set of Linear Color Key controls appears in the Effect Controls panel below the first set.
  3. In the Effect Controls panel, choose Keep Colors from the Key Operation menu.
  4. Select the color you want to keep.
  5. In the first application of the Linear Color Key effect, choose Final Output from the View menu in the Effect Controls panel, and then turn other instances of the Linear Color Key effect back on to examine the transparency. You may need to adjust colors or reapply the key a third time to get the results you need.