javascript - Photoshop CC Javascript - 翻转图层/图像

标签 javascript photoshop

我需要能够垂直或水平翻转图像/事件图层。

纵观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/

相关文章:

javascript - 在 Javascript 中使用 RegEx 来匹配字符交换的相似字符串

javascript - 将 md-fab-toolbar 与 ng-repeat 结合使用

javascript - Photoshop 脚本数组到 json

javascript - jQuery 插件 datetimepicker 未被 Date() 对象包装器识别为日期的问题

javascript - 即使 js 文件已加载到 Android 上,phonegap 插件 : Torch undefined,

Photoshop JSX 脚本 - 关闭 Photoshop

javascript - Photoshop 脚本 : Move an image to position x, y

javascript - 使用 For 循环时图像未正确对齐

javascript - Chart JS 圆环图饼图悬停偏移

applescript - 如何使用applescript在photoshop(cs5)中获取当前打开文件的路径?