Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects How to determine size of object in composition after mask applied

  • Paul Roper

    March 14, 2013 at 9:04 am

    It depends on what you want to achieve – if you just want to find out the dimensions of this one layer, just bring up your rulers (command/ctrl r), and keep an eye on the info palette while dragging some rulers onto the composition, and do some subtraction to find the result.

    However, if you need to do this many times and pass that value to another layer or something, you’ll have to write an expression. Unfortunately the .width function does not take into account masks, so using thisComp.layer(“intel_temperatures.tif”).width will not be useful. You could use the sampleImage function (it’d look something like: thisComp.layer(“intel_temperatures.tif”).sampleImage([200,200],[.5, .5])
    …which gets the value of the colour (and more importantly in this application, the alpha value which will tell you when you’ve reached the edge of the image) of the pixel(s) of a layer at (in this example) x=200, y=200, with a sample radius of 1 pixel (extending .5 pixels in each direction).

    You’d have to make a fairly laborious if….then loop to sample each pixel. It’s too complex for me to go into now, but there are quite a few tutorials out there. Or maybe if you repost the question in the expression section, you’ll get lucky and someone will help you further.

    – Paul

  • Phil Johnson

    March 14, 2013 at 9:23 am

    Thank you very much. I used the rulers method and it served my pupose. Thanks for you help. 🙂

  • John Cuevas

    March 14, 2013 at 11:31 am

    Another method you could have use(if you need to do this in the future) is the Crop to Region of Interest. Select the Region of Interest(ROI) button under your comp window(next to the Full/Half/Quarter Resolution Toggle) and make your ROI the gadget. Then under the composition tab, choose Crop Comp to Region of Interest, press Cntl+K to get the dimensions, and a cntl+z to return to your regular comp size.

    Johnny Cuevas, Editor
    Thinkck.com

    “I have not failed 700 times. I have succeeded in proving that those 700 ways will not work. When I have eliminated the ways that will not work, I will find the way that will work.”
    —THOMAS EDISON on inventing the light bulb.

  • Phil Johnson

    March 14, 2013 at 5:07 pm

    Thanks guys. You really helped me. It’s all done now. Thanks again. I will keep this crop method in mind for future use.
    I used the ruler method, it’s not 100% accurate, but it worked for what I wanted to do.
    Next time I’ll use the ROI crop method.

  • Darby Edelen

    March 14, 2013 at 6:03 pm

    There are a couple of ways to do this.

    My recommendation would be to select your mask and press cmd-shift-m/ctrl-shift-m (Mac/PC). This will give you a dialog that has the offsets of the mask’s bounding box. In order to get the width/height you’ll need to do some math:

    Height = Bottom – Top
    Width = Right – Left

    These pixels are in the layer’s transform space so if the layer has been scaled to 50% you’ll need to multiply your results by 0.5 to get the size of the mask in the composition.

    This is pretty easy but requires some simple arithmetic.

    The other option is to start by pre-composing the masked layer with “Move All Attributes” selected. This will move the mask into the pre-comp.

    Then go into the pre-comp and draw out a Region of Interest (see the AE help) that bounds the area. Under the Composition menu you can then use Composition > Crop Comp to Region of Interest.

    In your parent composition the size of the pre-comp layer should now be the size of the region of interest you drew out. Of course this technique depends on you drawing an accurate region of interest, but it’s pretty fast and mindless.

    Darby Edelen

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