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

Loading Images from After Effects to ScriptUI (ExtendScript)

Participant ,
Aug 17, 2020 Aug 17, 2020

Is there a way to load image data from an AE FootageItem? I know how. a file based workflow works, but I'd like to get the images for my UI straight from the AE Project it modifies.

 

So, this is working: https://www.youtube.com/watch?v=CVvdykFNXAY

While this is not:

w = new Window ("palette");

var theImageFile = app.project.item(7).item(1); //an image in a folder in my AE Structure
var theImage = w.add ("image", undefined, theImageFile);

w.center();
w.show();

 

If I add +".png" to the theImageFile in theImage i get:

Corvin0_0-1597654010690.png

Makes Sense, still I try to load footage into the UI 😉

TOPICS
Error or problem , How to , Scripting , SDK , User interface or workspaces
1.0K
Translate
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

Community Expert , Aug 17, 2020 Aug 17, 2020

what about this?

var theImageFile = app.project.item(7).item(1).mainSource.file;

 Each item that refers to a footage file has a mainSource property and its file property is a file object representing the actual file on disk. Note that mainSource will be undefined it the item is a comp or solid, for example.

Translate
LEGEND ,
Aug 17, 2020 Aug 17, 2020

I don't think this is an intendend workflow and that it will ever work. There's all sorts of loops running that keep footage items under surveillance and if nothing else it is simply containerized for safety reasons and memory management.

 

Mylenium

Translate
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
Participant ,
Aug 17, 2020 Aug 17, 2020

I was afraid so 😉

Translate
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
Community Expert ,
Aug 17, 2020 Aug 17, 2020

what about this?

var theImageFile = app.project.item(7).item(1).mainSource.file;

 Each item that refers to a footage file has a mainSource property and its file property is a file object representing the actual file on disk. Note that mainSource will be undefined it the item is a comp or solid, for example.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Translate
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
Participant ,
Aug 17, 2020 Aug 17, 2020

Wohoo, that works, thanks Mathias!

 

A little insight on my project: I'm working on a "duell" template for sport events, elections etc. and want my UI to be built from wathever graphics a specific folder in AE contains. And the template is working with the same files in a dozen precomps to create various graphics, so I have only one master folder in AE that needs to be changed to create multiple templates/generators.

Translate
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 ,
Oct 08, 2021 Oct 08, 2021
LATEST
w = new Window ("palette");

var theImageFile = getImage("abc.jpeg"); //an image in a folder in my AE Structure
var theImage = w.add ("image", undefined, theImageFile);

w.center();
w.show();

function getImage(imageName){
  for (i = 1; i <= app.project.numItems; i++){
    if (app.project.item(i) instanceof FootageItem && app.project.item(i).name.indexOf(imageName) != -1){
      return app.project.item(i).mainSource.file;
    }
  }
}
Translate
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