Skip to main content
Corvinus Corax
Inspiring
August 17, 2020
Answered

Loading Images from After Effects to ScriptUI (ExtendScript)

  • August 17, 2020
  • 3 replies
  • 1172 views

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:

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

This topic has been closed for replies.
Correct answer Mathias Moehl

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.

3 replies

Participant
October 8, 2021
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;
    }
  }
}
Mathias Moehl
Community Expert
Mathias MoehlCommunity ExpertCorrect answer
Community Expert
August 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
Corvinus Corax
Inspiring
August 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.

Mylenium
Legend
August 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

Corvinus Corax
Inspiring
August 17, 2020

I was afraid so 😉