Skip to main content
til5
Participating Frequently
April 20, 2018
Answered

Get x/y position (and width/height) of the transform box of a layer (not chopped off bounds)

  • April 20, 2018
  • 1 reply
  • 12063 views

Hi there,

There are tons of great scripts out there to query the position and size of layers (e.g. outlined in this thread Export layer coordinates, layer width and height? )
However, I can't seem to find a way / to get the top left anchor position of the transfrom bounding box. All scripts I could find use "bounds" which chopps off everything that's not visible in the layer. But I would need the actual values that do show up in the info box while working in Photoshop. Is there any way to get those values out to a text file. Batch/Script would be awesome, but any hint helps. Thanks!

I hope this picture clarifies what I am after. Notice that the box is way bigger than the actual layer content (I don't need the precisely cut-out bat that "bounds" gives you!)

Cheers,
Til

This topic has been closed for replies.
Correct answer r-bin

Read this topic. Maybe this is it

Get Layer Transform X Y Top Left Coordinate Position

1 reply

Legend
April 20, 2018

If the layer is normal and has only a mask, then you can try.

var tmp = activeDocument.activeLayer.layerMaskDensity;

activeDocument.activeLayer.layerMaskDensity = 0;

alert(activeDocument.activeLayer.bounds)

activeDocument.activeLayer.layerMaskDensity = tmp;

You can also get the "boundsNoMask" property for the layer via the AM code.

til5
til5Author
Participating Frequently
April 20, 2018

Hi r-bin,
Thanks a lot for your message and suggestion! So sorry, I totally forgot to mention the layer is a smart object that does not have a mask. Then your suggestion wouldn`t work, right? ...maybe I should edit the post and mention it as it is probably important to know (hm, can`t edit the original post).
Cheers,
Til

til5
til5Author
Participating Frequently
April 20, 2018

Read this topic. Maybe this is it

Get Layer Transform X Y Top Left Coordinate Position


Hi r-bin,

 

Yes, I think this is exactly what I was looking for! I am pretty useless when it comes to coding, just copying stuff. Didn't succeed in merging anything valuable myself yet. I might ask X-ram if he succeeded in his goal and if he would want to share the code...

My ultimate goal is to merge this code snippet to

 

Adobe-Export-Scripts/Export Layer Coordinates Photoshop.jsx at master · bronzehedwick/Adobe-Export-Scripts · GitHub

 

Thanks again for pointing me to above thread and your earlier snippet r-bin!