Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Find the average of two colors

  • Brendon Murphy

    September 11, 2020 at 5:56 pm

    You could do this:

    Add an adjustment layer with 3 color controls as shown in the image.

    Use the first two to pick the colors you want averaged. Add the following expression to the third, “Average” control:

    firstColor = effect(“First color”)(“Color”);

    secondColor = effect(“Second color”)(“Color”);

    (firstColor+secondColor)/2;

    Clicking into the average control won’t show you the actual values, so you may want to add a text layer in the comp with the following expression on “Source Text”.

    avgColor = thisComp.layer(“Color check”).effect(“Average”)(“Color”);

    red = avgColor[0];

    blue = avgColor[1];

    green = avgColor[2];

    if(colorDepth ==8){

    multiplier=255

    };

    if(colorDepth ==16){

    multiplier=32768

    };

    if(colorDepth ==32){

    multiplier=1

    };

    “Average color”+”\r”+red*multiplier+”\r”+blue*multiplier+”\r”+green*multiplier+”\r”;

  • Kevin Snyder

    September 11, 2020 at 6:37 pm

    Great! Thank you. I appreciate it.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy