FORUMS: list search recent posts

Add image to comp from project

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nick Leigh
Add image to comp from project
on Dec 2, 2010 at 7:53:59 pm

I think I have seen it before in a script but I can't find it. How do you add an image to a comp from a project. So the image is already in the project, or if it is easier to just get the file from the hard drive. Thanks

Nick

CS5 Production Suite


Return to posts index

Dan Ebberts
Re: Add image to comp from project
on Dec 2, 2010 at 8:08:26 pm

You find the image in the project bin by going through the items looking for the FootageItem with the correct name. Then you add it to the layer collection like this:

myComp.layers.add(myFootageItem);


Dan



Return to posts index

Ryan Lewis
Re: Add image to comp from project
on May 1, 2013 at 12:27:30 pm

My first post in what seems to be an awesome community here...

I may be asking this wrong, but how would one change the content of a frame to be the content of an image or layer in the project? (And where would I add such an expression???)

For example:
- I have one layer making calculations about source footage.
- I have several other images that need to show up if/when certain conditions are met
- Each image could potentially be shown 0, 1, or multiple times, so I don't want to create a layer for each instance. I'd rather dynamically determine if/when/how-many-times to show each. (Does that make any sense?)

Many thanks! And glad to be a part of AE Expressions group on CC!

Cheers!
Ryan

switch(i)
{
case 1:
// show image1.jpg at position x,y
break;
case 2:
// show image2.jpg at position x,y
break;
case 3:
// show image3.jpg at position x,y
break;
default:
// do nothing
}


Return to posts index


Dan Ebberts
Re: Add image to comp from project
on May 1, 2013 at 2:22:26 pm

One way to do it would be to have a control layer with a Slider Control that "publishes" the layer index of the image layer that should be currently visible. Each of image layers would have an opacity expression like this:

s = thisComp.layer("control").effect("Slider Control")("Slider");
if (s == index) 100 else 0


Dan



Return to posts index

Ryan Lewis
Re: Add image to comp from project
on May 1, 2013 at 8:25:24 pm

Excellent, Dan!
Indexing looks like it'll help! I was thinking something similar (to expressing the opacity), but my only hang-up would be how to show multiple instances of each layer without statically creating multiple copies of each. This is because ahead of time, I don't necessarily know how many instances I'll need of each image. (Like 8 red balloons vs. 3 blue ballons.)

Worst case scenario, I could create the maximum # of copies I'll need for each and then just map the index to a layout representation so I can place the copies in different locations. I just feel like there's got to be a more elegant solution to displaying multiples than statically predefining instances... (This is the coder in me striving for simplicity. Haha.)

By the way, I'm honored that THE Dan Ebberts is writing me. I love your page, sir! Inspirational! I wouldn't be tackling these projects if it weren't for you! :)

Many many thanks, Dan!

Ryan


Return to posts index

Ryan Lewis
Re: Add image to comp from project
on May 1, 2013 at 11:15:02 pm

Just did the math on (max potential # instances) x (# of source images) and that would leave me with about 2160 layers to turn on and off! Yikes! I suppose if I stick to a strict indexing convention, it is totally feasible but I worry about AE performance in managing that many layers at once...

http://forums.creativecow.net/thread/2/890911


Return to posts index


Dan Ebberts
Re: Add image to comp from project
on May 2, 2013 at 12:02:24 am

Yikes indeed. Does it have to be live? If not, you could use a script to create only the instances you need.

Dan



Return to posts index

Ryan Lewis
Re: Add image to comp from project
on May 2, 2013 at 12:15:32 am

Yeah, the trick is to render the components dynamically, so when fed with different input footage, the behaviour is the same...

My other thought is to make a precomposition with all of the source raster images as layers (about 15) and then I'd only have to create 144 instances of the precomposition (max number of coexisting instances). Much more manageable.

The precomposition could then have a controller that tells which of the 15 images to display. The main composition would determine how each of those performed.

Now my only question is how to directly access a slider/controller/property in a lower precomp...

I found this thread...
http://forums.creativecow.net/thread/227/23959#23959

And assume that I could do something similar...

C = comp("maincomp");
L = C.layer(thisComp.name);


Return to posts index

Dan Ebberts
Re: Add image to comp from project
on May 2, 2013 at 1:14:18 am

I'm not sure I understand precisely what you have in mind, but I do want to make sure that you realize you'll have to duplicate the precomp 144 times in the project panel so that they are separate instances, not duplicated as layers in the main comp.

Dan



Return to posts index


Ryan Lewis
Re: Add image to comp from project
on May 2, 2013 at 1:20:27 am

Oh, good point. Thanks! I've made that mistake before.

Basically, that "publish" action you described, I'd be implementing in the precomp and then perhaps sending a param from the main comp (or pulling one in) that decides which of the 15 rasters to display.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]