Skip to main content
Participant
May 8, 2011 3:14 PM UTC
Question

Combining Channels

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.

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

JJMack
Community Expert
Community Expert
May 9, 2011 3:22 AM UTC

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.

Translate
JJMack
Bearbob1Author
Participant
May 10, 2011 3:38 PM UTC

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

Translate
Inspiring
May 10, 2011 8:45 PM UTC

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

Translate