Skip to main content
Participant
Jun 9, 2025 5:06 PM UTC
Answered

sampleImage bug (or user error?)

Hello.

 

I am trying to dyamically return the color value of a text layer based on the color value of the layer underneath its position (which is a video). This is my expression. It is applied to the Source Text of the text layer. All I get is [0,0,0,0] no matter where the text layer is location within the composition.

 

sampleImage(transform.position, radius = [8, 8], postEffect = true, t = time)

 

It is this a bug or ... user error?

 

Evan

 

 

Dan Ebberts
Dan EbbertsCorrect answer
Community Expert
Jun 9, 2025 8:32 PM UTC

If you're trying to sample the layer below the text layer in the layer stack, I'd try it this way

thisComp.layer(index+1).sampleImage(transform.position, radius = [8, 8], postEffect = true, t = time)

:

 

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
Jun 9, 2025 8:32 PM UTC

If you're trying to sample the layer below the text layer in the layer stack, I'd try it this way

thisComp.layer(index+1).sampleImage(transform.position, radius = [8, 8], postEffect = true, t = time)

:

 

Translate
Participant
Jun 10, 2025 12:00 AM UTC

Thanks Dan. That did the trick.

Translate