Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Script: Resize Comp

  • Script: Resize Comp

    Posted by John Gate on February 27, 2019 at 3:27 pm

    Hi there,

    If i resize (height and width) of a comp from comp settings, it resizes fine.

    However when i try to resize it with script like this
    comp.width = newWidth;
    comp.height = newHeight;

    it resizes differently. I tried to google but couldnt find any script that resizes like comp settings panel.

    please advise
    Thanks

    John Gate replied 7 years, 2 months ago 2 Members · 4 Replies
  • 4 Replies
  • John Gate

    February 27, 2019 at 6:46 pm

    Thank you for your reply,

    I tried it and it works good but i want to just set a width only and height to remain same.
    When i used this included script, and chose width, it automatically resized the height too.

    I hope someone have delt with this situation with scripting here.

  • Walter Soyka

    February 27, 2019 at 7:08 pm

    You should do the same thing that “Scale Composition.jsx” does — use a null to manipulate the entire scene:

    1) Create a new 3D null.
    2) Step through all layers in the comp, and make all unparented layers a child of the null. (Pick up bonus points if you fix a bug in Scale Composition by correctly handling locked layers!)
    3) Resize the comp as you have above.
    4) Move the null half the difference in width to the right.
    5) Delete the 3D null.

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Walter Soyka

    February 27, 2019 at 10:55 pm

    That will resize the layers to maximum width, not re-position them within the new width of the comp.

    The problem that John is having is that when you change the comp size through the comp settings window, the default behavior puts the anchor of that resize in the center of the comp. When you change the size of a comp via scripting, it works as if you set the resize anchor to the upper left corner.

    Walter Soyka
    Designer & Mad Scientist at Keen Live [link]
    Motion Graphics, Widescreen Events, Presentation Design, and Consulting
    @keenlive   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • John Gate

    February 28, 2019 at 9:29 am

    Thank you for your response
    @Walter, You, Sir a genius

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