How to load a selection?

旧时模样 提交于 2019-12-25 09:28:58

问题


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

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:


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'));


来源:https://stackoverflow.com/questions/25665405/how-to-load-a-selection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!