color sampler using sampleImage expression method
A little while ago, someone asked on a forum how they could get a readout of color values for one or more points that would update as you tweaked color correction settings.
I whipped together an expression using the sampleImage method.
The idea is simple: Have a text layer with its Source Text property tied to the output from sampleImage, with the input to sampleImage being a point control that you can drag someplace and then just leave it while you fiddle with your colors.
I’m not saying that this is the most elegant solution, but here is what I came up with.
targetLayer = thisComp.layer(thisLayer.index+1);
samplePoint = targetLayer.effect("Point Control")("Point");
sampleRadius = [1,1];
sampledColor_8bpc = 255 * targetLayer.sampleImage(samplePoint, sampleRadius);
R = Math.round(sampledColor_8bpc);
G = Math.round(sampledColor_8bpc);
B = Math.round(sampledColor_8bpc);
A = Math.round(sampledColor_8bpc);
outputString = " R: " +R+ "r G: " +G+ "r B: " +B+ "r A: " +A
This will create a text layer that reports 8-bpc RGBA values for the point under the crosshair for the Point Control effect.
If you’re using an adjustment layer for your color correction, the adjustment layer is the layer that you’ll want to measure.
You can obviously get a lot fancier with this, but this should be enough to get you started.