This article assumes that you are familiar with basic After Effects processes and terminology, and are working with After Effects CS5.5 or higher.
The Info panel is a wonderful thing – a veritable treasure trove of little known information. One of its handiest features is getting per-pixel RGBA information for use in creative work and color correction. Unfortunately, unlike Photoshop, it is not possible to put down persistant sample points for display in the Info panel. But with a little bit of expression coding, we can approximate it.
For this, you will need the following:
- An image/movie to be measured. We’ll call it “Bob” because it’s more entertaining to anthropomorphize our working materials.
- One Point Control expression controller
- One 3D Point Control expression controller
- Knowledge of the sampleImage() method
The sampleImage() method requires four pieces of information in the argument; the last two are optional:
- The point of the image/movie to be sampled. (A 2D array)
- The sample size around the sample point (a 2D array)
- Whether or not masks on the layer will be respected (a Boolean)
- The time when the image will be sampled (a number)
For a more detailed explanation, look at Dan Ebbert’s excellent article here.
The sampleImage() method returns an array of four dimensions – 1 for each of the three color channels and one for the alpha channel. It’s possible to use sampleImage() to refer to another layer, but in this case we’ll do everything on Bob. We’ll also ignore the optional parts of the argument; since we’re working on a still without masks, we don’t need them.
Placing the Expression Controllers
We only need to place two expression controllers on Bob to access the information we want: one to determine the sample point and one to display the information we need. The 2D point control will provide the sample point, and the 3D point control will display the color information. “But wait,” you may say, “the sampleImage() method returns a 4 dimensional array!” That is true, and because of that we’ll have to do a little tweaking in the expression.
But first, let’s place the expression controllers. Select Bob in the timeline and choose Effect<Expression Controls<Point Control, and then choose Effect<Expression Controls<3D Point Control. Optionally, in the Effect Controls panel, you can select the Point Control effect, and then press “return” to rename it “Sample”, and do the same for the 3D Point Control and rename it “Color Data”.
Writing the Expression
Now that we have our expression controllers set up, we can write the expression to access the image’s color values. We’ll need to set up a couple of variables first: one to determine the location of the sample point, and three to access the individual color channels and ignore the alpha channel.
Alt/Opt-click on the 3D Point Control’s stopwatch and type the following:
We set up the variable “color” so that we can break apart the pieces of the sampleImage() method more easily. And when we press “return” on the keyboard we see…
So, how to do that? Multiply the maximum color bit depth value by the value produced by the sampleImage() method, and then round to the nearest integer. That is to say, replace the last line of the expression above with the following four lines:
Now you will see your color information in the 3D Point Control effect display in 8-bit color depth information. You could use 65,535 if you were working in 16-bit color depth, or 4,294,967,295 if you were working in 32-bit color depth, but that is a bit more cumbersome for an example such as this…
Extending the Principle
Thus far, we have created only one pair of expression controllers for a single sample point, but we could produce as many pairs for as many sample points as we need. You could also create an effect preset of three pairs (shadows, mids and highlights) and a curves or levels effect for a refined color correction workflow. You can also use it to make sure that any creative color grading is consistent between shots. Ideally, your color correction/grading will be done in Speedgrade or Resolve, but this method works in a pinch or if you prefer After Effects as your main color editor.