Rotating a layer using extendscript in Photoshop with orientation, angle and coordinates options…
Rotation Orientation Syntax:
- QCSCorner0 : Top Left
- QCSSide0 : Top Center
- QCSCorner1 : Top Right
- QCSSide3 : Middle Left
- QCSAverage : Middle Center
- QCSSide1 : Middle Right
- QCSCorner3 : Bottom Left
- QCSSide2 : Bottom Center
- QCSCorner2 : Bottom Right
Independent Rotation Orientation Syntax :
- QCSIndependent
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
function rotatelayer(orientation,xcor,ycor,angle) { var desc1 = new ActionDescriptor(); var ref1 = new ActionReference(); ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt')); desc1.putReference(cTID('null'), ref1); desc1.putEnumerated(cTID('FTcs'), cTID('QCSt'), sTID(orientation)); var desc2 = new ActionDescriptor(); desc2.putUnitDouble(cTID('Hrzn'), cTID('#Pxl'), xcor); desc2.putUnitDouble(cTID('Vrtc'), cTID('#Pxl'), ycor); desc1.putObject(cTID('Ofst'), cTID('Ofst'), desc2); desc1.putUnitDouble(cTID('Angl'), cTID('#Ang'), angle); // Angle desc1.putEnumerated(cTID('Intr'), cTID('Intp'), cTID('Bcbc')); executeAction(cTID('Trnf'), desc1, DialogModes.NO); }; |
Usage: ( Orientation, X Coordinate, Y Coordinate and Angle )
1 |
rotatelayer ("QCSSide0",0,0,45); |
Leave a Reply
Want to join the discussion?Feel free to contribute!