Copy link to clipboard
Copied
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 😉
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
I was afraid so 😉
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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;
}
}
}