Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Find out the size and position of an object in a layer

New Here ,
May 21, 2021 May 21, 2021

Copy link to clipboard

Copied

Hello. How to convert a PSD file to HTML/CSS? Or to any other file, where the size and position of the object in the layer will be indicated.
Or how do I find out the position of an object in a layer?

I got tired of finding the position and size of the object every time.

TOPICS
How to, Import and export, Make It

Views

473

Likes

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

Adobe Community Professional , May 22, 2021 May 22, 2021
try { var bounds = activeDocument.activeLayer.bounds; alert ("\nx: "+bounds[0]+"\ny: "+bounds[1]+"\nwidth: "+(bounds[2]-bounds[0])+"\nheight: "+(bounds[3]-bounds[1])) } catch (e) {}

Likes

Translate

Translate
Adobe Community Professional ,
May 22, 2021 May 22, 2021

Copy link to clipboard

Copied

try {
    var bounds = activeDocument.activeLayer.bounds;
    alert ("\nx: "+bounds[0]+"\ny: "+bounds[1]+"\nwidth: "+(bounds[2]-bounds[0])+"\nheight: "+(bounds[3]-bounds[1]))
}
catch (e) {}

Likes

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
New Here ,
May 30, 2021 May 30, 2021

Copy link to clipboard

Copied

How to use these? Just in case. I want the position from the top left.

Likes

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
Adobe Community Professional ,
May 30, 2021 May 30, 2021

Copy link to clipboard

Copied

LATEST

 

You first need to save the JavaScript and install or run it ad-hoc. Everything you should need to know is detailed here:

 

Downloading and Installing Adobe Scripts

 

When run, you will be presented with a prompt informing you of the co-ordinates starting from the upper left.

 

I had a 300x300px canvas, with targeted layer content in the upper left corner, this is the result of running the script:

 

alert.png

 

 

Likes

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