: How to get Layer size (Width and Height)? I have a number of layers in a Photoshop document. I want to find out what a specific layer's width and height is. How do I do that?
I have a number of layers in a Photoshop document.
I want to find out what a specific layer's width and height is. How do I do that?
More posts by @XinRu324
2 Comments
Sorted by latest first Latest Oldest Best
For anyone who wants to grab width/height in a single click and copy it, I created a script (based on this answer). You can bind the script to a hotkey too, as described below.
Step 1: Save the script
Copy the code below and save it in a file named "getLayerSize.jsx". If using Notepad, save the file WITH the double quotes.
function getLayerSizeToCopy(){
var layer = activeDocument.activeLayer; //Grab the currently selected layer
// Calculate length and width based on the rectangular bounds of the selected layer
var length = layer.bounds[2]-layer.bounds[0]; //Grab the length
var width = layer.bounds[3]-layer.bounds[1]; //Grab the width
// Remove pixels from the length/width "200 px" => "200"
length = length.toString().replace(' px', '');
width = width.toString().replace(' px', '');
prompt( "Layer Size: ", length + ", " + width );
}
getLayerSizeToCopy();
Step 2: Create an Action
Open the action menu if not already (Window > Actions). Create a group if you prefer. Add a new action, you can set an F-key here.
Step 3: Record a macro that runs the script
Click "Record" to start recording events for the macro. Then run the script from File > Scripts > Browse. Once you run it, close the popup with width/height. Now stop recording.
Finished!
Test the macro by pressing the hotkey assigned, or run the macro manually. Hopefully it works!
Note: Photoshop may lag if you select a large number of layers or a large group, instead of a single layer. I don't know how to fix that, but just wait for a few moments and it should catch up.
Troubleshooting:
If you get a script error, check that a layer is selected and not a group or adjustment layer.
If you can't see the script for step 3, make sure the filetype is ".jsx". Windows might name it ".jsx.txt" which will count as a text file, and you won't see it.
Option 1.
I have an action that does this:
Cmd+A, Cmd+C, Cmd+N
When I run this action I'm left with New document window. The width and height in the window are the clipboard image dimensions = your objects/layers dimensions.
You then can press Esc to close the window.
( On windows just think of the Cmd as Ctrl )
Option 2.
You can make a selection of the layer for example by ctrl or cmd clicking the layer thumbnail and then looking at the info panel F8, it will show you the dimensions of the selection.
From the upper right corner where you can see the arrow pointing down, you can find the options and within there you can set the ruler unit to pixels or what ever you want it to show.
Option 3.
Use Free transform Ctrl+T and when free transform is active, go check the Info panel F8 as shown above. This works even if the object is outside the document area.
Here's another answer that is slightly related:
How to measure the distances in .psd
Especially the bottom part of the answer that lists methods to exporting layer styles as css, which includes width and height, of course.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.