sampleImage script command
This is both a ExtendScript bug report and a feature request.
Bug first. This "hack" worked in earlier versions of AE:
var sliderControl = layer("ADBE Effect Parade").addProperty("ADBE Slider Control");
sliderControl.name = "temppscontrol";
sliderControl(1).expression = "thisLayer.sampleImage([300,50], [1,1]);";
var alpha = sliderControl(1).value;
It would get the sampled alpha from an AVLayer. It doesn't return the correct value any more, because the script moves on before the sampleImage expression has run.
Feature request: It would be nice if sampleImage was simply included in ExtendScript.
This bug was fixed in the April 2019 release of After Effects (version 16.1). You can install this release via the Creative Cloud desktop application.
A list of bugs fixed in After Effects 16.1 can be found here: https://helpx.adobe.com/after-effects/kb/fixed-issues.html
Saar Oz commented
Hey Tim. From my tests this issue has not been resolved. Retrieving SampleImage data while the panel opens up worked, but while the panel is open doing the same task returns the wrong value most of the time.
Voted. For the script command, not the bug fix !
i.e, it would be nice to have layer.sampleImage() is the scripting API.
Jakob Wagner commented
Hi. Thank you for testing and getting back.
After further investigation, I can see that the problem only occur if it's in a panel. I have three files for you:
test sample image.aep
TestSampleImageSingle.jsx (normal script)
TestSampleImage.jsx (ScriptUI panel script)
Select the composition layer and run the scripts. The single script will correctly alert "1" while the panel will alert "0". Even though the temp_ps_slider will actually show the value "1" afterwards.
This is not a new issue as you can see here: https://forums.adobe.com/message/9036823#9036823
I have two plugins now which could really benefit from this, so it would be awesome if you could get it nailed.