ChannelMerge

The ChannelMerge node lets you merge together one channel from each input and save the result in the selected output channel. All other channels are copied unchanged from the B input.

If no A input is connected, both channels to merge are taken from the B input.

By default, ChannelMerge combines the inputs’ alphas.

Inputs and Controls

Connection Type

Connection Name

Function

Input

A

The image that contains a channel to merge with a channel from input B. This input is optional.

B

The image that contains a channel to merge with a channel from input A. If no A input is connected, both channels to merge are taken from this input.

mask

An optional image to use as a mask. By default, the merge is limited to the non-black areas of the mask.

At first, the mask input appears as triangle on the right side of the node, but when you drag it, it turns into an arrow labeled mask. If you cannot see the mask input, ensure that the mask control is disabled or set to none.

Control (UI)

Knob (Scripting)

Default Value

Function

ChannelMerge Tab

A channel

N/A

enabled

Enables the associated A channel to the right. Disabling this checkbox is the same as setting the channel to none.

A

rgba.alpha

The channel to merge from input A. If no A input is connected, this channel is taken from input B.

operation

operation

union

Sets how the pixel values from input A are calculated with the pixel values from input B to create the new pixel values that are output as the merged image:

absminus abs(A-B) - how much the pixels differ.

b if not a A?A:B - shows A wherever A exists; otherwise shows B.

divide A/B, 0 if A<0 and B<0 - divides the values but stops two negative values from becoming a positive number.

from (B-A) - subtracts A from B.

in Ab - only shows the areas of image A that overlap with the alpha of B.

max (max(A,B)) - selects the lighter of the two colors as the resulting color. Only areas darker than B are replaced, while areas lighter than B do not change.

min (min(A,B)) - selects the darker of the two colors as the resulting color. Any parts that are lighter than B are substituted. Any parts of the image that are darker than B don’t change.

minus (A-B) - subtracts B from A.

multiply (AB, A if A<0 and B<0) - multiplies A by B. The result is always darker. Blending with black gives black and with white returns the color unchanged.

out A(1-b) - only shows the areas of image A that do not overlap with the alpha of B.

plus A+B - the sum of the two colors. Increases brightness to lighten A and reflect B.

stencil B(1-a) - this is the reverse of the out operation. Only shows the areas of image B that do not overlap with the alpha of A.

union A+B-AB - shows both image A and B.

xor A+B-2AB - shows both image A and B where the images do not overlap.

B channel

N/A

enabled

Enables the associated B channel to the right. Disabling this checkbox is the same as setting the channel to none.

B

rgba.alpha

The channel to merge from input B.

output

N/A

enabled

Enables the associated output channel to the right. Disabling this checkbox is the same as setting the channel to none.

output

rgba.alpha

Render the merged image into this output channel.

Set BBox to

bbox

union

How to output the bounding box:

union - combine the two bounding boxes.

B side - use the bounding box from input B. Any data from the A input that’s outside this box is clipped.

A side - use the bounding box from input A. Any data from the B input that’s outside this box is clipped.

mask

N/A

disabled

Enables the associated mask channel to the right. Disabling this checkbox is the same as setting the channel to none.

maskChannelInput

none

The channel to use as a mask. By default, the merge is limited to the non-black areas of this channel.

inject

inject

disabled

Copies the mask input to the predefined mask.a channel. Injecting the mask allows you to use the same mask further downstream.

invert

invert_mask

disabled

Inverts the use of the mask channel so that the merge is limited to the non-white areas of the mask.

fringe

fringe

disabled

When enabled, only apply the effect to the edge of the mask.

When disabled, the effect is applied to the entire mask.

mix

mix

1

Dissolves between the original B input at 0 and the full merge effect at 1.