Skip to Content

How do you mask by color in after effects?

Masking by color in After Effects allows you to isolate and hide portions of an image based on its color values. This can be extremely useful for things like creating vignettes, highlighting subjects, and removing distractions in your footage. In this article, we’ll break down everything you need to know to get started masking by color in After Effects.

Selecting a Color Range

The first step to masking by color is selecting a color or tonal range to isolate. Here are a few ways to sample colors in After Effects:

  • Use the eyedropper tool to click on a color in the Composition, Layer, or Footage panel. This will set the foreground color.
  • Enable the “Show Layer Samples” option in the Layer panel. This displays color chips next to your layers based on the colors in the composition.
  • Add a color sampler marker to your footage by clicking the Add Color Sampler button in the Composition panel.
  • Use the Color Picker to manually select a color value.
  • Use the Color Range effect to select a color range in the Effects & Presets panel.

Once you’ve sampled a color, be sure to expand or contract the range slightly for a more realistic selection. A range of around 10-30 tends to work well for most images.

Creating a Solid Color Layer

With your color range selected, next create a new solid color layer. This will be used to generate the mask.

  1. In the Composition panel, select Layer > New > Solid.
  2. Name the layer something like “Color Mask”.
  3. Set the solid color to the sampled color range you want to mask.
  4. Click OK to create the solid color layer.

Adding the Mask

Now it’s time to add the color mask to the new solid layer:

  1. With the solid layer selected, click the Pen Tool to make sure you are in mask creation mode.
  2. Draw a mask around the entire solid layer.
  3. In the Mask options, set the Mask Mode to “None”. This will hide everything inside the mask shape.
  4. Use the Mask Feather option to soften the mask edge if needed.

The solid layer will now become an invisible mask based on the sampled color range.

Masking the Footage Layer

With the color mask solid layer complete, you can now use it to mask portions of your main footage layer:

  1. In the Timeline panel, drag the color mask solid layer above the main footage layer you want to mask.
  2. Set the Track Matte option on the footage layer to Alpha Matte “Color Mask”.

This uses the transparency of the solid layer to mask out the matching color range in the footage layer beneath it. Try moving the solid layer around to isolate different colors.

Masking Video in After Effects

Masking by color can also work well for video footage too. The process is the same, but you’ll want to take a few extra steps:

  • Add your video to a new composition sized to match the footage.
  • Sample your target color range from a single frame of video.
  • Create the color mask solid using that sampled range.
  • Use the Track Matte method to apply the mask to your footage.
  • Animate the mask layer over time to follow the color range as lighting and angle changes.

This takes more effort, but can isolate subjects in complex shots. Use markers on the solid layer to help track the mask position per frame.

Tips for Masking by Color

Here are some additional tips for getting the best results when masking by color in After Effects:

  • Use soft, diffused edges on your color mask to make the transition look more organic.
  • For people, sample skin tones from the forehead or cheeks to avoid irregularities.
  • Adjust the mask shape over time to account for lighting and angle changes.
  • Feather the mask edge between 10-50 pixels depending on the image resolution.
  • Limit color sampling to a single frame or region to prevent irregularities.
  • Invert the mask to isolate a color range rather than hide it.

Masking Limits in After Effects

While masking by color can be very effective, it does have some limits:

  • It works best with solid, uniform colors like skin tones or shirt colors.
  • Irregular patterns, textures, and gradients can cause uneven masking.
  • Changes in angle and lighting can require manually animating the mask.
  • Masking video requires more manual work compared to images.
  • Some colors like blonde hair or white may be hard to isolate.
  • Reflections and shadows can also be challenging to mask cleanly.

Even with these limits, masking by color is a valuable tool for isolating and highlighting subjects creatively. Just be prepared to put in some work animating the mask for best results, especially with video content.

Other Ways to Mask in After Effects

In addition to masking by color, here are a few other common masking techniques in After Effects:

Luminance Masking

This masks based on the brightness values in an image rather than color. It works well for masking shadows and highlights.

Chroma Key Masking

Also known as green screen masking. This removes a specific color backdrop from footage to insert backgrounds.

Rotoscoping

Rotoscoping involves manually animating masks frame-by-frame to isolate and cut out foreground elements.

Shape Masking

You can create masks using the shape tools to isolate subjects based on their outlines and forms.

Mask Tracking

After Effects includes mask tracker effects to automatically animate masks to follow movement in shots.

Each technique has its own strengths depending on the footage and your goals. Mastering manual masking skills first will make using auto tools easier later.

Conclusion

Masking by color can be a powerful method for isolating subjects and selectively hiding elements in your shots. To use it effectively, carefully sample your color range, create a matching solid layer, then use that layer as a track matte mask on your footage. Add feathering and manually animate the mask to account for any changes. Combining masking by color with other methods opens up even more possibilities for unique effects!