在Photoshop脚本JS中选择图层的某个区域

时间:2017-04-28 14:12:28

标签: arrays photoshop

我是新手。我知道我必须使用某种代码,例如docRef.selection.select(),但我不知道如何正确填充这些空格。

1 个答案:

答案 0 :(得分:0)

你需要一个数组。

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像素画布上,这将选择具有10像素边框的所有内容

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

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

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

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