Answered
How to get the width/height of a layer in a script
Hello all, I am trying to make a small script that resizes a layer (shrinking) to fit the canvas/image size... I am trying to do this by querying both the document width/height then comparing it to the layer width/height, but I cannot find any way to find the layer width/height... any suggestions? I have tried the code below but it brings back an 'undefined'.
app.preferences.rulerUnits = Units.PIXELS;
var docHeight = app.activeDocument.height;
//alert(docHeight);
var docWidth = app.activeDocument.width;
//alert(docWidth);
var layerWidth = app.activeDocument.activeLayer.width;
alert(layerWidth);
//this line above returns the 'undefined"How can I get the activeLayer width and height?
Thanks!
