Skip to content

Instantly share code, notes, and snippets.

@animoplex
Last active March 30, 2023 12:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save animoplex/635d9d7990783e52913103f0ac811995 to your computer and use it in GitHub Desktop.
Save animoplex/635d9d7990783e52913103f0ac811995 to your computer and use it in GitHub Desktop.
Sample Luminance Value - After Effects Expression by Animoplex
// Sample Luminance Value - Created by Animoplex: www.animoplex.com
// Samples the luma value of a defined area and converts to a specified value within a range.
// Use samplePoint to specify luma location
// Use sampleSize to adjust the sample area
// Last line: 0 - 1 is input, 0 - 100 is output
// Full Tutorial: https://www.youtube.com/watch?v=QkqiaPZJa1Y&t=62s
target = comp("SOURCE COMP").layer("SOURCE LAYER");
samplePoint= [960,540]; // Sample location
sampleSize= [50,50]; // Sample area (in pixels)
lum = rgbToHsl(target.sampleImage(samplePoint,sampleSize))[2];
linear(lum, 0, 1, 0, 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment