• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to get mask / path size?

Engaged ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

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

TOPICS
SDK

Views

736

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Mar 02, 2023 Mar 02, 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

Votes

Translate

Translate
LEGEND ,
Mar 01, 2023 Mar 01, 2023

Copy link to clipboard

Copied

No.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 02, 2023 Mar 02, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 07, 2023 Mar 07, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines