Skip to main content
Participant
January 31, 2021
Question

Applying different color keys to one layer in AE

  • January 31, 2021
  • 1 reply
  • 152 views

In After Effects, I have an image layer that consists a few colors. Underneath I have several other layers (textures). I want to replace each color of the image above with one of the textures below. Is there an easy way to apply multiple color keys to this one image - and to link each color key to a different texture layer?

Thank you

This topic has been closed for replies.

1 reply

Community Expert
February 1, 2021

You will need a null you can position over, or the position value for the color you want to sample in your image. Then each layer you are going to tint will need to have an expression tied to a color control that looks at the master image color position and assigns that color to the current layer. 

 

The expression would look like this:

smpl = thisComp.layer("Master Image");
point = thisComp.layer("Null 1 - First Sample").position;
smpl.sampleImage(point, radius = [.5, .5], postEffect = true, t = time)

The "smpl" is the layer you want to sample. The Null (Null 1 - First Sample) would be placed over the spot on the "Master Image" layer in the comp that you wanted to sample. The third line looks at the point, just one pixel, and creates color values from that pixel. If you added this expression to a shape layer fill the fill color would always match the color under the null.

 

The problem with this workflow is that the "point" is based on the layer size, not the comp size so if the Master Image is not the same size as the comp you need to compensate for the difference in size, position, scale, and rotation. By far the easiest way to solve that problem is to hold down the shift key and parent the null to the Master Image layer. 

 

Hope this helps.

yog95Author
Participant
February 7, 2021

Thank you,  I'll give it a try!