Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Replacing a Picture…but Maintaining the Size

  • Replacing a Picture…but Maintaining the Size

    Posted by Jeffrey Gansen on November 27, 2008 at 5:01 pm

    I am using Adobe After Effects 6.0 for this project.

    I have a comp that is being used as a template and solids as place holders for pictures. When I replace the place holders with pictures, I have to resize the picture. I get all sorts of different sizes of pictures. Also, I get some that are horizontal, some that are vertical.

    Is there an expression that will make every picture the same size and can compensate for vertical or horizontal.

    Jeffrey Gansen
    http://www.worldwideeffects.com

    Mike Berg replied 15 years ago 3 Members · 3 Replies
  • 3 Replies
  • Kevin Camp

    November 28, 2008 at 10:14 pm

    if your solids were created at comp size, then this may work for you:

    s = thisComp.height / height;
    [s*value[0],s*value[1]]

    or, if you wanted to base the scale off the solid’s width:

    s = thisComp.width / width;
    [s*value[0],s*value[1]]

    either of those pasted into the scale property should scale the image to match the scale of the solid, but only if the solid was originally created at comp size, the expression will compensate for any scaling that was made to the solid after it was created.

    as far as horizontal or vertical, do you mean you need to rotate the image 90 degrees if it is vertical, or just handle the scaling properly? the above expressions will scale proportionally if it is vertical or horizontal as long as any scalling that was applied to the solid was proportional. however, i can’t think of a way to rotate an image based on the subject of the image, unless you flagged them some how… and i think it may be easier to rotate them manually.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Jeffrey Gansen

    December 2, 2008 at 6:08 am

    Your expression worked PERFECTLY!!! Thank you so very much! You just saved me a ton of time.

    in regards to the rotation:
    I was wondering if there was an expression, like the one you gave me, that would determine which way the photo was orintated and scale off of that. However, I found that if I do have vertical pictures, I will have to resize it again. This expression at least gives me a good starting point with the vertical pictures and the work it saves me with horizontal pictures more than makes up for it.

    Thank you again
    Jeffrey Gansen

  • Mike Berg

    May 12, 2011 at 4:20 pm

    I have an old project that didn’t have its JPGs saved with it. I’ve been able to get the photos back, but they’re all saved at different sizes. When I “Replace Footage” and import the new JPGs, they are sized very differently than they were set to be originally. Is there a way to force an image to fit into the space of the original (if that makes sense)? I’m not using solids, so they weren’t created at comp size… I’ve got about 50 animated JPGs that I’d rather not have to resize manually. Any help would be hugely appreciated.

    -Mike

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy