How to got layer dimensions (with transparent border)?
Hi to everybody, this is my first post.
I need to know the really dimensions of a layer with border trasparent for resize it to same dimensions of other layer.
well, if use the bounds datas, i got the dimensions of the pixels, but not the really dimensions of the layer.
With this script i would like resize the "mask" layer and the "frame" layer to the same size of the picture layer, but like i work with transform command (CTRL+T).
there are anybody know how to do?
Thanks
G.
--- Script ---
var doc = app.activeDocument
var thisLayer = doc.activeLayer;
// got the group of layers
var thisGroup = thisLayer.parent;
//main layer (photo)
var thisPict = thisGroup.layers[2];
var ThisPictBounds = thisPict.bounds;
var thisPictW = ThisPictBounds[2].as('px')-ThisPictBounds[0].as('px');
var thisPictH = ThisPictBounds[3].as('px')-ThisPictBounds[1].as('px');
//mask layer
var thisMask = thisGroup.layers[1];
var ThisMaskBounds = thisMask.bounds;
var thisMaskW = ThisMaskBounds[2].as('px')-ThisMaskBounds[0].as('px');
var thisMaskH = ThisMaskBounds[3].as('px')-ThisMaskBounds[1].as('px');
// frame layer
var thisFrame = thisGroup.layers[0];
var ThisFrameBounds = thisFrame.bounds;
var thisFrameW = ThisFrameBounds[2].as('px')-ThisFrameBounds[0].as('px');
var thisFrameH = ThisFrameBounds[3].as('px')-ThisFrameBounds[1].as('px');
// rename all layers
thisPict.name = thisGroup.name + '>' + 'Pict';
thisMask.visible = false;
thisMask.name = thisGroup.name + '>' + 'Mask';
thisFrame.name = thisGroup.name + '>' + 'Frame';
// resize mask and frame layers
thisMask.resize ((thisPictW/thisMaskW)*100,(thisPictH/thisMaskH)*100, AnchorPosition.MIDDLECENTER);
thisFrame.resize ((thisPictW/thisFrameW)*100,(thisPictH/thisFrameH)*100, AnchorPosition.MIDDLECENTER);
// ### example ###
// thisMaskW = 489 (974 - 485 ) >> Real width layer dimension usig CTRL+ T command
// thisMaskH = 316 (519 - 203) >> Real height layer dimension usig CTRL+ T command
// thisMaskW = 258 (769 - 511 ) >> Pixel width dimension got by bouds data
// thisMaskH = 259 (492 - 233) >> Pixel height dimension got by bouds data
// How got real layer dimension?

