ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

How to determine size of object in composition after mask applied

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Phil Johnson
How to determine size of object in composition after mask applied
on Mar 14, 2013 at 8:08:04 am

Hi

I hope someone can help me.
I'd like to know how I can determine the exact dimensions of an object/layer in the composition window after I've applied a mask to it.
Like this: http://2share.co.za/Files/d674a913-cb21-4635-9771-aef66ac27146AE1.jpg this is the original file, but I want to cut out the gadget in the corner

like this http://2share.co.za/Files/d674a913-cb21-4635-9771-aef66ac27146AE1.jpg

Now I want to know what the size of the gadget alone is in the composition. I can't check in the project window because it'll give me the original size of the layer.

I hope it is possible. Please help.

Thank you.


Return to posts index

Paul Roper
Re: How to determine size of object in composition after mask applied
on Mar 14, 2013 at 9:04:57 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


Return to posts index

Phil Johnson
Re: How to determine size of object in composition after mask applied
on Mar 14, 2013 at 9:23:21 am

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


Return to posts index


John Cuevas
Re: How to determine size of object in composition after mask applied
on Mar 14, 2013 at 11:31:21 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.


Return to posts index

Phil Johnson
Re: How to determine size of object in composition after mask applied
on Mar 14, 2013 at 5:07:55 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.


Return to posts index

Dave LaRonde
Re: How to determine size of object in composition after mask applied
on Mar 14, 2013 at 2:12:32 pm

If we knew what you intend to accomplish by determining these precise dimensions, we may be able to offer alternate techniques.

Dave LaRonde
Former Sr. Promotion Producer
KCRG-TV (ABC) Cedar Rapids, IA


Return to posts index


Darby Edelen
Re: How to determine size of object in composition after mask applied
on Mar 14, 2013 at 6:03:31 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]