我需要能够垂直或水平翻转图像/事件图层。
纵观Adobe Photoshop CC Javascript Reference activelayer/对象似乎没有翻转方法。
doc.flipCanvas(Direction.VERTICAL)
确实有效,但显然会垂直翻转整个文档,因为我只想在事件图层上进行翻转
我可以在 invert()
方法中看到它确实提到:
inverts the selection (deselects the selection and selects the rest of the layer or document). Tip. To flip the selection shape, see rotate
这说明了以下内容:
rotate (angle [, anchor]) -
Rotates the selection by the specified amount around the specified anchor
我已经像其他地方一样使用旋转方法,但不知道如何通过此方法翻转图像?
obj.rotate( rotation, AnchorPosition.TOPLEFT );
最佳答案
ArtLayer没有翻转方法,您可以使用.resize
代替:
Resizes the layer to the specified dimensions (as a percentage of its current size) and places it in the specified position.
activeDocument.activeLayer.resize(-100,undefined); //will flip layer horizontally
activeDocument.activeLayer.resize(undefined,-100); //will flip layer vertically
( anchor 还有第三个参数)
关于javascript - Photoshop CC Javascript - 翻转图层/图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53397230/