I'm a newbie trying to split a selected layer into multiple layers, each with only one channel enabled. What I mean into the script below, I’d like to do that same thing I do manually by going into Layer Style, in Advanced blending where it has the Channels R checkbox, G checkbox, B checkbox, for my R layer uncheck the G & B.
I've got a start on grouping, copying the layers, renaming them as I'd like, but I don't know how to do the equivalent of what I described above.
What I have so far...
var doc = app.activeDocument,
currentLayer = doc.activeLayer;
var group = doc.layerSets.add();
group.name = currentLayer.name;
var bLayer = currentLayer.duplicate(); // duplicate layer in target doc
bLayer.name = 'Blue:' + currentLayer.name;
currentLayer.visible =false;
//somehow here I’d like to do that same thing I do manually in
//Layer Style, in Advanced blending it has
//Channels R checkbox, G checkbox, B checkbox
//for my R layer uncheck the G & B
bLayer.move( group, ElementPlacement.PLACEATEND ); // move it
doc.activeLayer = bLayer;
var gLayer = bLayer.duplicate();
gLayer.name = 'Green:' + currentLayer.name;
gLayer.blendMode = BlendMode.NORMAL;
//somehow here I’d like to do that same thing I do manually in
//Layer Style, in Advanced blending it has
//Channels R checkbox, G checkbox, B checkbox
//for my G layer uncheck the R & B
gLayer.opacity = 100.0;
doc.activeLayer = gLayer;
var rLayer = gLayer.duplicate();
rLayer.name = 'Red:' + currentLayer.name;
rLayer.blendMode = BlendMode.NORMAL;
//somehow here I’d like to do that same thing I do manually in
//Layer Style, in Advanced blending it has
//Channels R checkbox, G checkbox, B checkbox
//for my R layer uncheck the G & B
rLayer.opacity = 100.0;
doc.activeLayer = rLayer;