How to obtain the current layer size
Gets the current high layer width size
Request to give me an example
Thank you very much
How to obtain the current layer size
Re: How to obtain the current layer size
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();
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();
Re: How to obtain the current layer size
Thank you, thank you very much
- Stephen_A_Marsh
- Posts: 38
- Joined: Sun Aug 04, 2019 12:37 pm
Re: How to obtain the current layer size
One can also use
to remove the unix suffix:
https://gist.github.com/MarshySwamp/342 ... 3ef5b456ba
Code: Select all
.value
https://gist.github.com/MarshySwamp/342 ... 3ef5b456ba