在 Photoshop 脚本 JS 中选择图层的特定区域

Selecting a certain area of a layer in Photoshop script JS

我是新手。我知道我必须使用像这样的代码 docRef.selection.select(,,,) 但我不知道如何正确填补这些空间。

你需要一个数组。

var docRef = app.activeDocument;

//(topleft, bottomleft, bottomright, topright)
var shapeRef = [ [10,10], [10,90], [90,90], [90,10] ];
docRef.selection.select(shapeRef);

在 100 x 100 像素上 canvas 这将 select 所有内容都带有 10 像素边框

您还可以通过其他方式使用docRef.selection:

// inverse selection
docRef.selection.invert();

//select all
docRef.selection.selectAll();

//deselect all
docRef.selection.deselect();