Fit2Frame


Version: 1.1 Sign up to be notified by email when a new version of this script is posted
Fits selected layers (they can be different sizes and pixel aspect ratios) proportionally to fill the Comp frame by giving you the choice of either cropping or letterboxing.





I’m wondering if there is a way to get an image to fill the screen and be the comp size. As of now it has the option of either letter box (e.g. will make a portrait pictures height match the frame but the width will be cropped smaller) or crop (which will make the width fit but the height will still be out of the frame) for example I need to make all the layers the same size for a wall effect animation.
Either way this script saved me a lot of time.
Thanks
Are your layers rotated? Otherwise, wouldn’t Layer->Transform->Fit to Comp do the trick?
If you have to deal with rotated images it’s very simple to modify the script to do fit to comp just let me know and i’ll modify it for you.
The script works incorrectly when Pixel Aspect Ratio is not Square
It can be visible when Aspect Ratio of the Image and the Comp is near same.
Here is the mistake:
var myLayerAspectRatio = (myWidth/myHeight);
var myCompAspectRatio = (myComp.width/myComp.height);
it should be
var myLayerAspectRatio = (myWidth*myLayer.source.pixelAspect/myHeight);
var myCompAspectRatio = (myComp.width*myComp.pixelAspect/myComp.height);