3 Replies Latest reply on May 10, 2011 1:45 PM by Michael L Hale

    Combining Channels

    Bearbob1

      I have two channels I would like to combine into a single channel to create an Alpha. I haven't been able to figure out anyway to get the two channels to add together...

       

      Ideally it would function the same way as if you went threw the calculations feature and used a blending mode of add.

       

      Any help would greatly appreciated.

        • 1. Re: Combining Channels
          JJMack Most Valuable Participant

           

           

          You can use the blending effects associated with layers to combine channels within and between images into new images. You can use either the Apply Image command (on single and composite channels) or the Calculations command (on single channels). These commands offer two additional blending modes not available in the Layers panel—Add and Subtract. Although it’s possible to create new combinations of channels by copying channels to layers in the Layers panel, you may find it quicker to use the calculation commands to blend channel information.

          The calculation commands perform mathematical operations on the corresponding pixels of two channels (the pixels with identical locations in the image) and then combine the results in a single channel. Two concepts are fundamental to understanding how the calculation commands work.

          • Each pixel in a channel has a brightness value. The Calculations and Apply Image commands manipulate these values to produce the resulting composite pixels.

          • These commands overlay the pixels in two or more channels. Thus, the images used for calculations must have the same pixel dimensions.

           

          You man not find Calculations... and Apply Image in Photoshop scripting guide but I beleive you should be acle to script these funcuions useing som ScriptListener code.

          • 2. Re: Combining Channels
            Bearbob1 Level 1

            The ScriptListener plugin doesn't turn out any code from the calculations menu...

            • 3. Re: Combining Channels
              Michael L Hale Level 5

              Bearbob1 wrote:

               

              The ScriptListener plugin doesn't turn out any code from the calculations menu...

              It should. Here is a cleaned up version of the scriptlistener output when I use calculations to combine the red(target) and green channel of an RGB document to an alpha.

               

                  var desc3 = new ActionDescriptor();
                  desc3.putClass( charIDToTypeID('Nw  '), charIDToTypeID('Chnl') );
                      var desc4 = new ActionDescriptor();
                          var ref2 = new ActionReference();
                          ref2.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
                      desc4.putReference( charIDToTypeID('T   '), ref2 );
                      desc4.putEnumerated( charIDToTypeID('Clcl'), charIDToTypeID('Clcn'), charIDToTypeID('Add ') );
                      desc4.putDouble( charIDToTypeID('Scl '), 1.000000 );
                      desc4.putInteger( charIDToTypeID('Ofst'), 0 );
                          var ref3 = new ActionReference();
                          ref3.putEnumerated( charIDToTypeID('Chnl'), charIDToTypeID('Chnl'), charIDToTypeID('Grn ') );
                      desc4.putReference( charIDToTypeID('Src2'), ref3 );
                  desc3.putObject( charIDToTypeID('Usng'), charIDToTypeID('Clcl'), desc4 );
                  executeAction( charIDToTypeID('Mk  '), desc3, DialogModes.NO );