• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Error: Argument 1 to SampleImage() must be 2 numbers

New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I am getting this error

 

Error: Argument 1 to SampleImage() must be 2 numbers

 

In this expression 

 

samplePoint = thisComp.layer("gradient").effect(index+1)("3D Point"); sampleRadius = [10,10]; thisComp.layer("gradient").sampleImage(samplePoint, sampleRadius);

 

I have seen other tutorials using similar scripts (that don't specify a number), so I don't know how to narrow down the issue. I am not too experienced with scripts so I'm a bit lost here.

 

Thanks for the help 🙂 

 

To put things in context I am following this tutorial https://www.youtube.com/watch?v=NYueHX4-Zg8

 

 

TOPICS
Error or problem , Expressions , Scripting

Views

394

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , May 26, 2021 May 26, 2021

I don't know what effect you're trying to grab the point from but is it perhaps that your '3D Point' is three numbers [X,Y, Z] rather than 2?

In that case you could probably fix it in the last line by packaging the x and y parts back up into an [X, Y] array:

thisComp.layer("gradient").sampleImage([samplePoint[0],samplePoint[1]], sampleRadius);

 

Votes

Translate

Translate
Enthusiast ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I don't know what effect you're trying to grab the point from but is it perhaps that your '3D Point' is three numbers [X,Y, Z] rather than 2?

In that case you could probably fix it in the last line by packaging the x and y parts back up into an [X, Y] array:

thisComp.layer("gradient").sampleImage([samplePoint[0],samplePoint[1]], sampleRadius);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

LATEST

Thanks Paul. This did the trick! 🙂 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines