How to load a selection?

2019-09-07 11:00发布

I am trying to load my selection like the picture below, where the marching ants go around the edges of my object:

enter image description here

However, i only know how to select the whole layer using this code:

doc.selection.selectAll();

Also, i want to contract the selection by a few pixels and paste it into a channel layer. Any help with that would be great but the most important thing is how to load the selection in the first place.

1条回答
Viruses.
2楼-- · 2019-09-07 11:23

If you look up in the Javascript Scripting Reference document in your Photoshop install directory you'll see that there are a number of methods available on the selection object to do what you need.

var doc  = app.activeDocument;
var channelRef = doc.channels.getByName("TestSelection");
doc.selection.load(channelRef, SelectionType.REPLACE);
doc.selection.contract(new UnitValue(20, 'px'));
查看更多
登录 后发表回答