Skip to main content
Richard Rosenman
Inspiring
March 2, 2023
Answered

How to get mask / path size?

  • March 2, 2023
  • 4 replies
  • 1405 views

Hi gang!

 

Hope everyone is doing well.

 

I have a relatively simple question this time: what is the best approach to get the mask size within a layer?

 

By that, I mean the extents of the mask? So if I have a composition that is 1920x1080 and I have drawn a circle mask in it, with a size of 255x255, that is the size that should be reported.

 

I know I could read the mask and then loop through all the vertex positions to record the minimum and maximum x & y but is there a simpler (and less intensive) process than that?

 

Thanks in advance!

-Rich

This topic has been closed for replies.
Correct answer James Whiffin

This should do the trick and it returns in floating point precision:

 

Given a layer’s handle and a time, returns the bounds of area visible with masks applied.
AEGP_GetLayerMaskedBounds

4 replies

James Whiffin
James WhiffinCorrect answer
Brainiac
March 3, 2023

This should do the trick and it returns in floating point precision:

 

Given a layer’s handle and a time, returns the bounds of area visible with masks applied.
AEGP_GetLayerMaskedBounds
Richard Rosenman
Inspiring
March 7, 2023

Hi James!

Thanks for your helpful reply. After some research I was able to successfully use GetMaskedBounds to get the mask extents. Certainly much easier (and faster) than looping through all the verts!

 

Thanks again,

Richard

ShiveringCactus
Adobe Expert
March 2, 2023

I think these days, with Track Mattes able to be reused and not having to be directy above a layer, if I need to know a circular masks size, I'd be tempted to use a shape layer as a track matte.  This gives me all the transform properties and allows for easier changing etc...  If you're using a mask for effects (as opposed to cutting out), you might still be able to get away with a track matte with an adjustment layer, but that all depends on the context. 

Adobe Expert
March 2, 2023

going through the vertices is the fastest way i know of.

Mylenium
Brainiac
March 2, 2023

No.

 

Mylenium