Expressions/Scripts/Presets

Moderator: byronnash

 
Adam
Topic Author
Posts: 2
Joined: Fri Jun 15, 2007 11:17 pm

Scale multiple compositions by percent

Sun Jun 17, 2007 4:39 am

We often need to scale a few hundred movies by 50% and then re-render them. There is already a script that ships with After Effects 7 which allows you to do this one composition at a time, but this gets pretty tedious.

If any of you could write something that allows you to select multiple comps from the project window and scale them all by a percent, I would be very grateful.

-Adam
 
nab
Posts: 203
Joined: Tue Nov 29, 2005 3:00 am
Location: Royan
Contact:

Sun Jun 17, 2007 6:45 pm

Hi Adam,
you could try something like that

var percent = prompt("Resize factor (percentage):","50");
var mySelection = app.project.selection;           
app.beginUndoGroup("scaleSelectedComps.jsx");     
for (var i = 0; i < mySelection.length; i++)
{
   if (mySelection[i] instanceof CompItem)
   {
      var compName = mySelection[i].name + " resized";
      compName = compName.substring(0,31);
      var W = Math.round(mySelection[i].width * percent/100);   
      var H = Math.round(mySelection[i].height* percent/100);
      var pixAsp = mySelection[i].pixelAspect;
      var Dur = mySelection[i].duration;
      var frRate = mySelection[i].frameRate;
      var resizedComp = app.project.items.addComp(compName,W,H,pixAsp,Dur,frRate);
      var myLayer = resizedComp.layers.add(mySelection[i]);
      myLayer.scale.setValue([percent,percent]);     
   }
}
app.endUndoGroup();
 
Adam
Topic Author
Posts: 2
Joined: Fri Jun 15, 2007 11:17 pm

Mon Jun 18, 2007 4:13 pm

nab,

That is exactly what we needed. Thank you very much for your work.

-Adam
 
dotcommer
Posts: 1
Joined: Sun Mar 06, 2016 6:13 pm

Re: Scale multiple compositions by percent

Sun Mar 06, 2016 7:28 pm

Sorry to dig up an old thread, but anyone able to help me out modifying this so it just overwrites the selected comps with the new scale instead of making duplicates with "resize" added at the end? I thought adding mySelection[i].remove(); at the end would work, but that seems to delete the layers in the original so the new comp is blank (but scaled correctly).

Thanks!

Who is online

Users browsing this forum: No registered users and 2 guests