Pixnub Home Page 2 › Forums › Sports Photo Automation › Mode to scale cutout based on left/right rather than top/bottom? › Reply To: Mode to scale cutout based on left/right rather than top/bottom?
I think I didn’t state that well. I need the smart object layer sized so that width of the cutout ends up being 2770px wide. Similar to mode 4 where I can scale the smart object layer until the top and bottom are where I want them to be, but I need the scaling to be based on the width reaching the target instead of the height.
In case it helps, here is the JS that I use in my action through the second run that might help you understand it better.
#target photoshop
var pxWidth = 2770;
var upperAthleteGroupRef = app.activeDocument.layerSets.getByName(“Upper Athlete”);
var spaGroupRef = upperAthleteGroupRef.layerSets.getByName(“SPA-Player-1-Mode-4”);
var upperPlayerLayerRef = spaGroupRef.artLayers.getByName(“SPA-Player-1”);
resizePixelWidth(upperPlayerLayerRef, pxWidth)
/**
* Resize layer to specified pixel width
* @Param the layer to resize
* @Param the resized pixel width
* @Return void
*
*/
function resizePixelWidth(l, pw){
preferences.rulerUnits = Units.PIXELS;
var b = l.bounds;
var w = b[2]-b[0];
var s = (pw/w)*100;
l.resize(s, s, AnchorPosition.TOPCENTER)
return
}
-
This reply was modified 7 months, 3 weeks ago by
JEFF HARMON.