FORUMS: list search recent posts

sampleImage returns inaccurate result?

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeremy Paul
sampleImage returns inaccurate result?
on Aug 20, 2017 at 9:05:06 pm
Last Edited By Jeremy Paul on Aug 20, 2017 at 9:05:59 pm

I'm playing around and stumbled upon this tutorial that uses greyness of a pixel to determine scale:

To get R value of a pixel it uses sampleImage() method. It samples the central point of a layer. I found it strange that even though the central point is still 100% black, scaling of a shape layer already occurred. Check this image at


for example.

The expression in question:

sampleSize = [1,1];
samplePoint = thisComp.layer("Control Layer").transform.position; // it is [960,540]
sampleColor = thisComp.layer("Control Layer").sampleImage(sampleSize,samplePoint)[0];


What am I missing here?

Return to posts index

Leopoldo Perizzolo
Re: sampleImage returns inaccurate result?
on Aug 26, 2017 at 2:57:20 pm

You simply switched the two arguments of the expression in sampleImage (just like the video did..)
It should be:

sampleImage(position, radius), and in your case:

sampleColor = thisComp.layer("Control Layer").sampleImage(samplePoint, sampleSize)[0];

Hope it's all clear.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved