Resize Composition to Layers Scale

Hi AEScripters,
could someone tell me why my script doesen't center all my layers?
(I'm trying to build a tiny crop tool)
thnx a lot
:F
Here is my code:
// written by fabiantheblind
// http://www.the-moron.net
function fitCompToLayer()
app.beginUndoGroup("fit Comp To Layer");
var activeComp = app.project.activeItem;
var selection = app.project.activeItem.selectedLayers[0];
var myScale = selection.scale.valueAtTime(0.0,false);
var myScaleW = myScale[0];
var myScaleH = myScale[1];
activeComp.width  = Math.floor((activeComp.width/100)*myScaleW);
activeComp.height = Math.floor((activeComp.height/100)*myScaleH);
// this doesn't work. but why?
var newWidth = app.project.activeItem.width;
var newHeight = app.project.activeItem.height;
var myLayers = activeComp.layers;
for(var i = 1; i< myLayers.length;i++){
myLayers[i].position[0] =   newWidth / 2;
     myLayers[i].position[1] =   newHeight / 2;
app.endUndoGroup();
fitCompToLayer();

haha. Or you make this the easy way like this:
To crop the composition to the region of interest, choose Composition > Crop Comp To Region Of Interest.
http://help.adobe.com/en_US/aftereffects/cs/using/WS3878526689cb91655866c1103906c6dea-7f05 a.html

Similar Messages

  • What happend to composition-cropped layers?

    Hi; when I try to import my .ai files to after effects my files look like a image. In the previous version on after effects has composition-cropped layers option. But in the new after effects version havent. There is just this 3 options "Footage", "Composition" and "Composition - Retain Layer Sizes". I read this links in the helps and saying we just change the name with 'Composition - Retain Layer Size'. But its not. I tried every thing on this link but Im still seeing my files like a image. I never make a cropped layers. How to make  a cropped layers how to see my all layers on after effects? Please help.
    http://help.adobe.com/en_US/aftereffects/cs/using/WS3878526689cb91655866c1103906c6dea-7f78 a.html#WS3878526689cb91655866c1103906c6dea-7f76a

    "AE use to bring in Illustrator files as the size of the artwork itself. Now it brings them in as the size of the artboard. Is there no way to tell AE to ignore the artboard?"
    That is not true. AE has always clipped Illustrator artwork to the size of the art board in the comp. There is a pain in the neck work around and a not so much of a pain in the neck work around.
    The pain in the neck work around is to convert the vector layer to a shape, reveal the shape layer properties, move the fill in group 2 (cropped layer) to group 1, then delete group 2.
    The not so much work around is to Edit original, increase the art board size to include all shapes, then reload your footage. If you choose this option I would start with a copy of the original Illustrator file.

  • Resizing Composition question...

    Hello,
    Forgive the noob question.
    I've resized the composition, and the footage I have within it doesn't resize. No problem, but then I select my footage and/or corresponding elements and then have to scale down.
    Is there a way to select footage/image/etc. and manually input a point size based on the comp settings size? Right now I select the object, and then go to scale under the tranform properties and find a percentage number the best fits. I'd like to be more precise, maybe use pixels dimensions instead of using percentage-based numbers.
    Thanks!

    What are you doing: making the original comp smaller, or making it bigger?
    To make it small, simply make a smaller comp, nest the larger original comp in the new comp, and scale the nested comp to fit the new comp.
    To make it large, there's a script that comes with AE that can do the trick.
    And I have absolutely NO notion why you can't get the necessary precision using the scale property as it is.  I don't think I've ever heard that come up before.  Your eyes must be a whole lot better than mine to see the difference between 23.42% and 23.43%.

  • Export multiple frames of a composition with layers intact

    I'm working with lower quality video and after many headaches with codecs I finally started using image sequences so I could do editing in photoshop then bring it into After Effects.  Now I want to go the other way.  Export an image sequence with layers intact so I can do further editing back in photoshop.
    I found this on an adobe help site:
    To export a single frame as an Adobe Photoshop file with layers, choose Composition > Save Frame As > Photoshop Layers.
    Is there a way to do this with a sequence?

    Check AEnhancers.com! There is a script somewhere there that sets up your million render outputs and enumerates them sequentially.
    Mylenium

  • Can't resize composition elements

    I'm creating a version of my site for mobile phones. So, I copied and pasted a  lightbox composition. I resized all of the elements in the lightbox to what they should be. However, the container element of the lightbox will not resize. I've tried dragging the borders, but it snaps back to the original size. I've also tried changing the size by typing in the new dimensions in the Width and Height boxes, but the element still snaps back to the original size. How do I fix this?

    Hello Bruce,
    In order to change the size of the Target container, you first need to change the size of the Image frames (for all the Target images in your Lighbox Widget) and if you have text captions then you also need to make sure that the size of text boxes for those text captions is also reduced. Only then you would be able to reduce the target container's size.
    Hope this helps.
    Regards,
    Sachin

  • Resizing images to a scale

    hi all,
    i have a bit of an annoying issue where i would like to print raster (image) drawings out to some /scale/.
    a good example would be a set of elevations and a plan that was scanned from a book but are basically /each/ in my computer as individual files at unknown scales.
    so i would like to
    1. RESIZE these drawings so they are all at the same scale and then
    2. i would like to resize them again so that i can print them to PDF (or whatever) and send them to a printer to have them print out at something like 1/8" = 1'-0".
    i have adobe photoshop suite of tools on the mac but posting to adobe forums has not yielded results.
    is there some slick mac program that will do this??
    if not, which mac development team do i explain this need so they can implement it?
    is there a good forum to post this question to?
    THANKS

    The OP's last post was from 2 years ago, so I wouldn't expect him/her to reply :-)
    However, if the problem is that you want to get notified while the frame is resizing, and not just after it has been resized, you can do this by setting the DynamicLayout property in java.awt.Toolkit to true, like this small test program demonstrates:
    import java.awt.Toolkit;
    import java.awt.event.ComponentAdapter;
    import java.awt.event.ComponentEvent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    public class ResizeTest extends JFrame {
        public ResizeTest() {
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            JLabel lbl = new JLabel("Label");
            getContentPane().add(lbl);
            pack();
            setLocationRelativeTo(null);
            lbl.addComponentListener(new ComponentAdapter() {
                public void componentResized(ComponentEvent e) {
                    // Print to the console everytime the label is resized:
                    System.out.println("componentResized");
        public static void main(String[] args) {
            // Set DynamicLayout to true:
            Toolkit.getDefaultToolkit().setDynamicLayout(true);
            new ResizeTest().setVisible(true);
    }Note this sentence from the javadocs for the setDynamicLayout method though:
    "Note that this feature is not supported on all platforms, and conversely, that this feature cannot be turned off on some platforms."

  • Font Resizing Isn't To Scale

    Hi,
    I need help with the font size. Whenever I type in small font sizes in Elements, such as 8-9pt font and lower, it comes up as GIGANTIC when it shouldn't be. I've tried restarting the program and checked the scale of my image, but neither proved to be successful.
    Any ideas on what this might be and/or how to fix it?
    Thanks!

    AnnieGraphics wrote:
    Hi,
    I need help with the font size. Whenever I type in small font sizes in Elements, such as 8-9pt font and lower, it comes up as GIGANTIC when it shouldn't be. I've tried restarting the program and checked the scale of my image, but neither proved to be successful.
    Any ideas on what this might be and/or how to fix it?
    Thanks!
    It could be that you need to zoom out your view or to select Actual pixels by going to:
    View >> Actual Pixels  (or use your keyboard keys ctrl + !)

  • Compositing layers creates pixel shift

    I have been compositing three layers, two are Animation codec QT, one is a TGA still. All are 1920x1080, millions+ and have their alpha channel knocked out. They composite, scale and effect fine. The problem is a 5 to 8 pixel shift on the X-axis that occurs on playback, RAM preview and naturally in the final render. There is no tell-tale filter or action that I can pinpoint that is causing this and I can't reproduce it verbatim every time.
    The layer that shifts is locked and has no keyframes, set to fixed resolution, it is a TGA, 32bit still. The composited layers are 1920x1080 QT 29.97, no interlace. Whole project is set to 29.97 as are the QTs being used.
    Any ideas, suggestions or similar experiences out there?
    I appreciate any advice you can offer.
    thanks
    dey
    G5DP Mac OS X (10.4.9)

    After many tries I have been unable to defeat the problem with the registration moving 1080 images around when compositing layers. The 2K limit is unacceptable. I have yet to upgrade to Motion 3 but I hope this is something they have addressed. If Motion cannot handle 1080 composites without glitches, it is useless to me and I'm sure, many others. Furthermore, if you are rendering for film, forget it. If the almost 2K images wreck the registration, anything larger would blow it up, too.
    I tried fixed resolution, cropping (this would be a band-aid anyway, the whole point of HD is to get the full image, not a percentage) reducing the scale slightly, nothing helps. Previewing at half-rez and then back to full, the image jumps several pixels. I am resorting to using FCP until I install another package of AE or Shake. Very disappointed in Apple. If FCP is HD capable, Motion should be moreso. How can you zoom, rotate or distort a 1080 image if the engine is going to squeeze it and push the center reg around?
    My advice to anyone experiencing this is to move to another solution, I have spent many hours trying to resolve this and am unable. Generally I attribute these things to PICNIC but this is definitely a software issue.
    Dear Apple, please give us Motion HD, and not at a premium. If Apple intends to stay the leader in digital imaging, these "Pro" apps must work together in harmony. The license belongs to Apple, no third-party excuse here.
    Ok, I'm done crying, back to work.
    G5DP 2GRAM 128VRAM Mac OS X (10.4.9)

  • Layers desynchronized outside a composition

    I have the next problem with After Effects CC. I converted CS6 file to a CC one, where, inside a composition, some layers are positioned very precisely. This layers are png, and they are overlapping a video. The problem is that, when I use this composition, outside I see that all the png layers are desyncronized, it's like they have been moved one frame forward. Then I go inside the composition and everything is perfect. I tried to move the layers to fix it, but the same problem occurs. Do you have any idea how to solve it? I don't want to repeat again all this work. Thanks for your time!

    Let me make sure I understand you correctly.
    Your PNG layers look perfect over the video. Then you place that composition inside another composition and it doesn't look right? What if you create a brand new composition and drop that one in?
    What are your frame rates? Could we see some screenshots?

  • Imported PSD Files Are Being Erroneously Resized in Captivate 4

    I am trying to import PSD files to use in my Captivate 4 project. I verified that the PSD image size is 800 x 600, and my Captivate project dimensions are the same 800 x 600. But when the import process completes, the layers are erroneously resized to smaller dimensions. I have tried the same thing on two separate installations of Captivate 4 on two separate PC's with the same results.
    Here is a screenshot of the PSD file in Photoshop (image size = 800 x 600):
    Now here is a screenshot of what the imported PSD file looks like in the Captivate project (screen size set to 800 x 600):
    When I do the import, I'm selecting: File --> Import --> Photoshop File..., then I select the "As Layers" option, and do not check the box next to "Scale according to stage size" (I have tried using this option as well with the same results, although I don't believe I should have to rescale when the PSD image size and Captivate project size are the same.)
    Any help with this would be greatly appreciated.

    Thanks so much for such a prompt reply...the single .psd file with many layers is imported using:
    Import Kind: Composition
    Layer Options: Editable Layer Styles; Life Photoshop 3D (although there are no 3D layers in the .psd...so I'm unsure if this default is needed?)
    Oh!!  Never mind...I just tried Import Kind: Composition -- Cropped Layers and the layers were not cropped...kind of counter-intuitive since I would have thought "Cropped Layers" would crop the layers rather than the other way around. 
    Thanks for your help...if you just reply to this post I'll mark your reply as the answer, thanks for suggesting the direction to look for a solution, cheers!

  • Layers got me confused?

    Okay so I made a little character on Photoshop, then moved it onto after effects. The character had many layers. How do I - let's use the arm as an example - move the arm's layer separately?

    Layers in AE work the same as they do in PS or AI.
    To import a layered PS or AI file into AE, go to File>Import>File navigate to the file and select it. In the Import As drop down choose Composition - Retain Layers. When you add this item to your timeline all of the corresponding layers will appear.
    In the timeline, click the arrow to expose the options for Position, Scale, Rotation, etc, to make changes to that layer. Here's a link with tutorials for working with layers Build compositions with layers | Adobe After Effects CC tutorials.
    Now if you are asking about animating the arm, say to wave, take a look at Understanding animation | Adobe After Effects CC tutorials.

  • After Effects CC 2014 problem: Image from frame from the last Premiere CC-After Effects link permanently burned into new project compositions.

    One frame from one of the clips I sent from Premiere to After Effects through "replace with After Effects composition" was permanently burned in After Effects and now it appears in every new composition of every new project I create as the background of such composition. 
    For example, I sent from Premiere a clip of a building to After Effects for color correction with Finesse, and warp stabilization and then after rendering, finishing, and closing all the applications, now, every time I open After Effects for any other project, whether already-created or brand-new, every existing or newly created composition (in a Mac Command N) you see the image of the building as the background of the composition.  If you create a new composition, while it remains empty of any layers, you see the image of the building.  If you have an already-created composition with layers, when you turn off all the eyes of the layers, you would expect to see black (nothing) in the composition window (if that's the color you assigned to be as the background of the comp), but instead you see the building.  If you change the color of the comp's background in Composition Settings, you still see the building as the background.  If you render such empty composition (no layers) you render out the image of the building, not black.  I tried clicking everywhere and going through the preferences, and even uninstalling the application and re-installing it, but it seems to be permanently burned in into every comp's background.
    Please, any ideas of what's going on and how to get rid of it?
    Thanks so much for your help,
    RR.

    Thanks so much Dave.  It fixed the problem.
    Raoul.

  • Batch: Open Bridge 'Stacks' as layers in PS CS5 + run action. Is this possible with script??

    I posted this topic a couple of days ago - I didn't know about this forum/group so the thread appears in Photoshop Scripting and Bridge Windows. I haven't found a solution on those forums - can any one here help?
    http://forums.adobe.com/thread/880777?tstart=0
    http://forums.adobe.com/thread/880779?tstart=0
    I would like to automate part of my workflow that involves opening stacked images (in Bridge CS5) as layers in Ps CS5 and running an PS action that composites the layers and processes the image. Something similar to 'Process Collection' in Bridge CS5 only with my own action instead of merge to HDR/Panorama.
    Apparently this is possible with Mac 'Automator' - is there anything I can do in Windows? I don't have any experience with writing scripts, but have friends that can help. Can someone tell me if its possible and point me in the right direction please?
    This needs to be a batch process. I know how to open images as layers from Bridge so that I can manually run the PS action - I would like to automatically process lots of images in this same way.
    To clarify, the script if possible will need to
    1) find first stack (in Bridge [in selected folder])
    2) open as layers in PS
    3) run PS action
    4) save and close (as psd preserving layers)
    5) find next stack in Bridge (selected folder) and repeat.
    By 'stack' I mean a set of similar files (for instance same scene -2EV, 0EV, +2EV)
    Bridge's 'Process Collection' feature is great because it very cleverly recognises similar images (I think you have to stack them first) opens them and either processes them into a hdr or panoramic image. Instead or hdr or pano, wouldn't it be great if you could run your own action.
    Bridge's Image Processor is fantastic at opening a batch of individual files and running your own processing action, but it won't open groups of images ('Stacks' or sets) as layers.
    What I need is basically a hybrid of the two.

    In case you miss my late append in the other thread you may want to look at the auto collection script that ships with the Bridge and use it as a base for what you want to do. You may also be able to automat the creation of your stacks if their time stamps are close. The Auto Collection Script night now does two types of stacks  HDR and Panoramas.  You may be able to modify it to do a third stack type. You stack type and use your stack processing process instead of mearge to HDR or PhotoMerge.
    From Bridge help:
    The Auto Collection CS5 script in Adobe Bridge assembles sets of images into stacks for processing as high dynamic range (HDR) or panoramic composites in Photoshop CS5. The script collects images into stacks based on capture time, exposure settings, and image alignment. Timestamps must be within 18 seconds for the Auto Collection script to process the photos. If exposure settings vary across the photos and content overlaps by more than 80%, the script interprets the photos as an HDR set. If exposure is constant and content overlaps by less than 80%, the script interprets the photos as being part of a panorama.
    Note: You must have Adobe Bridge with Photoshop CS5 for Auto Collection CS5 to be available.
    To enable the Auto Collection CS5 script, choose Edit > Preferences (Windows) or Adobe Bridge CS5.1 > Preferences (Mac OS).
    In the Startup Scripts panel, select Auto Collection CS5, and then click OK.
    Select a folder with the HDR or panoramic shots, and choose Stacks > Auto-Stack Panorama/HDR.
    Choose Tools > Photoshop > Process Collections In Photoshop to automatically merge them and see the result in Adobe Bridge.

  • Would like to automate open stacks as layers + run action. Possible with script??

    I would like to automate part of my workflow that involves opening stacked images as layers in Ps CS5 and running an PS action that composites the layers and processes the image. Something similar to 'Process Collection' in Bridge CS5 only with my own action instead of merge to HDR/Panorama.
    Apparently this is possible with Mac 'Automator' - is there anything I can do in Windows? I don't have any experience with writing scripts, but have friends that can help. Can someone tell me if its possible and point me in the right direction please?

    Sorry but a script can not access Lightroom so your first step isn't possible.
    Second step is Lightroom not Photoshop.
    Maybe something could be done if you could work out a Photoshop Only workflow.

  • Layers of imported .psd files are cropped?

    Hi, when importing .psd files the images on layers are cropped...?
    In Photoshop an image on a layer is moved across the visible portion of the document as if it is animated, through the use of comp layers (each new comp layer the image is move a little bit).  However after importing the .psd into After Effects only a portion of the image is visible...it is impossible to recreate the animation roughed out with Photoshop comps because some of the image on the layer being moved is cropped. 
    I hope that makes sense...how can .psd files be imported into After Effects without cropping?  Thanks

    Thanks so much for such a prompt reply...the single .psd file with many layers is imported using:
    Import Kind: Composition
    Layer Options: Editable Layer Styles; Life Photoshop 3D (although there are no 3D layers in the .psd...so I'm unsure if this default is needed?)
    Oh!!  Never mind...I just tried Import Kind: Composition -- Cropped Layers and the layers were not cropped...kind of counter-intuitive since I would have thought "Cropped Layers" would crop the layers rather than the other way around. 
    Thanks for your help...if you just reply to this post I'll mark your reply as the answer, thanks for suggesting the direction to look for a solution, cheers!

Maybe you are looking for

  • Text entry box

    Where in Captivate 5.5 is data stored when I input to the "text entry box" field? I want to capture data (e.g., name or employee number) and then output it to a file upon a person's completion of quiz.

  • Macbook Pro - Dual Cinema Displays?

    I know you can only have one dual-link 30" cinema display, but is it possible to dual-screen with two 20" or 23" cinema displays on a Macbook Pro with the built-in display disabled?

  • Same but a little different problem with iPod

    I installed my iPod shuffle and everything worked great. Then I tried to recharge it and now I have the same blinking light problem that everyone else has described. My difference is that my iPod is recognized in iTunes, but not recognized by Windows

  • Acquisition value negative in area

    Dear All , I got an error that is "Acquisition value negative in area "  while running CJ88 . The total of APC for that asset  is zero , not have negatif balance. ( The option of negatif value is allowed is not selected on asset.) Why i got that erro

  • When I error check my Pages-created epub, I get the error code "undeclared prefix: ibooks." How do I resolve this error?

    I'm creating an epub with Pages for upload to various sites. When I error check the epub, I get only one error message: "undeclared prefix: ibooks." The file itself works perfectly and looks fantastic when I open it directly from my computer/ipad wit