Convert layer brightness to percentages

This expression captures the color of the point of the layer and converts its brightness into percentages from 1 to 100. That is, absolutely black is the value zero, and the absolutely white color is 100. Color is captured under the Anchor Point of the layer in which the expression is written. You can use, for example, in the Opacity parameter.

target = thisComp.layer("color map");
rgbLuma = target.sampleImage(position,[3.5, 3.5]);
luma = rgbToHsl(rgbLuma)[2];
linear(luma, 0, 1, 0, 100)
Recommended Posts

Start typing and press Enter to search