So I’m new to Photoshop Scripting, but have a solid grasp of JS.
I’m trying to make a selection based on the ‘RGB’ channel, but my code is erroring, saying “No such element”. How can I load the RGB channel in the same way as the individual Red, Green, or Blue channels? If I replace RGB with Red, everything works perfectly.
var doc = app.activeDocument;
var currentLayer = doc.activeLayer;
var channelRef = doc.channels.getByName("RGB");
doc.selection.load(channelRef, SelectionType.REPLACE);
To clarify, I want the same functionality as clicking the ‘Channel to Selection’ icon in the channels panel with all channels selected.
2
Answers
I worked out the answer - record the action and copy the script it outputs. Helpful for anyone else needing to do this.
There is no RGB channel, by definition. You probably want an array of the three color channels: