Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

splitting layer into RGB layers in a group - newbie

$
0
0

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;

Viewing all articles
Browse latest Browse all 27456

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>