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

How to obtain the dimensions of the transparent area?

Explorer ,
Jul 10, 2024 Jul 10, 2024

Could you please tell me how to obtain the dimensions of the transparent area of the current layer? For example, I want to get the dimensions of the top, bottom, left, and right transparent areas separately. Specifically, I'm interested in obtaining the height of the top and bottom transparent areas, and the width of the left and right transparent areas.001.jpg

 

TOPICS
Actions and scripting
260
Translate
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

Community Expert , Jul 10, 2024 Jul 10, 2024

@meadX â€“ Ensuring that your calculations are set to pixels...

 

Use the app.activeDocument.activeLayer.bounds[0] for the left and app.activeDocument.activeLayer.bounds[1] for the top.

 

Use the app.activeDocument.width.value minus app.activeDocument.activeLayer.bounds[2] for the right.

 

Use the app.activeDocument.height.value minus app.activeDocument.activeLayer.bounds[3] for the bottom.

 

Related example code here:

 

https://gist.github.com/MarshySwamp/ef345ef3dec60a843465347ee6fcae2f

Translate
Adobe
Community Expert ,
Jul 10, 2024 Jul 10, 2024

@meadX â€“ Ensuring that your calculations are set to pixels...

 

Use the app.activeDocument.activeLayer.bounds[0] for the left and app.activeDocument.activeLayer.bounds[1] for the top.

 

Use the app.activeDocument.width.value minus app.activeDocument.activeLayer.bounds[2] for the right.

 

Use the app.activeDocument.height.value minus app.activeDocument.activeLayer.bounds[3] for the bottom.

 

Related example code here:

 

https://gist.github.com/MarshySwamp/ef345ef3dec60a843465347ee6fcae2f

Translate
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
Explorer ,
Jul 10, 2024 Jul 10, 2024
LATEST

Thank you very much, I will try it first, thank you

Translate
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