Get X and Y, and Width and Height of a layer

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: xbytor, DavideBarranca, Paul MR

jaysmith123
Posts: 3
Joined: Fri Nov 02, 2018 2:33 am

Get X and Y, and Width and Height of a layer

Postby jaysmith123 » Fri Nov 02, 2018 2:48 am

From a script, how do I get the x and y coordinates of a specific layer? Also, how do I get the width and height of a specific layer?
Attachments
x and y and width and height.PNG
x and y and width and height.PNG (1.62 KiB) Viewed 1267 times

User avatar
Kukurykus
Posts: 179
Joined: Mon Jul 25, 2016 12:36 pm

Re: Get X and Y, and Width and Height of a layer

Postby Kukurykus » Fri Nov 02, 2018 7:11 am

Code: Select all

b = activeDocument.activeLayer.bounds
x = b[0], y = b[1], w = b[2] - b[0], h = b[3] - b[1]
alert(x + ' & ' + y + ' & ' + w + ' & ' + h)

I sent you PM if you have more questions...


Return to “Photoshop Scripting - General Discussion”

Who is online

Users browsing this forum: No registered users and 11 guests