photoshop-python-api icon indicating copy to clipboard operation
photoshop-python-api copied to clipboard

How to rotate a selection ?

Open djs45 opened this issue 3 years ago • 1 comments

Hello. I have a problem with the API :

I make a selection in the document with script : app.activeDocument.selection.select(sel_area, ps.SelectionType.ReplaceSelection, 0, False) Work !

I want to rotate this selection but I need 2 argument and I can't set anchorposition (I want middlecenter) : app.activeDocument.selection.rotate(20 , ????? ) How can I set anchorposition please ?

Many thanks in advance

Sébastien

djs45 avatar Oct 12 '22 12:10 djs45

@djs45 Please try the below codes

from photoshop import Session


with Session() as ps:
    app = ps.app
    doc = app.activeDocument
    doc.selection.rotate(90, ps.AnchorPosition.MiddleCenter)

loonghao avatar Oct 13 '22 01:10 loonghao