Merge

Merge allows you to layer multiple images together. When using this node, you need to select a compositing algorithm that determines how the pixel values from one input are calculated with the pixel values from the other to create the new pixel values that are output as the merged image. The operation dropdown menu houses a large number of different compositing algorithms, giving you great flexibility when building your composite.

When using most of the available merge algorithms, Nuke expects premultiplied input images. However, with the matte operation you should use unpremultiplied images.

You can also create this node by pressing M on the Node Graph.

Inputs and Controls

Connection Type

Connection Name

Function

Input

A

The image sequence to merge with input B. When you connect the A input, a new input A1, A2, etc. is spawned allowing you to connect multiple image.

B

The image sequence to merge with input A.

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 isn’t disabled or set to none.

Control (UI)

Knob (Scripting)

Default Value

Function

Merge Tab

operation

operation

over

Sets the Merge algorithm to use:

atop - Shows the shape of image B, with A covering B where the images overlap. Algorithm: Ab+B(1-a)

average - The average of the two images. The result is darker than the original images. Algorithm: (A+B)/2

color-burn - Image B gets darker based on the luminance of A. Algorithm: darken B towards A

color-dodge - Image B gets brighter based on the luminance of A. Algorithm: brighten B towards A

conjoint-over - Similar to the over operation, except that if a pixel is partially covered by both a and b, conjoint-over assumes a completely hides b. For instance, two polygons where a and b share some edges but a completely overlaps b. Normal over produces a slightly transparent seam here. Algorithm: A+B(1-a)/b, A if a>b

copy - Only shows image A. This is useful if you also set the mix or mask controls so that some of B can still be seen. Algorithm: A

difference - How much the pixels differ. See also Absminus. Algorithm: abs(A-B)

disjoint-over - Similar to the over operation, except that if a pixel is partially covered by both a and b, disjoint-over assumes the two objects do not overlap. For instance, two polygons that touch and share an edge. Normal over produces a slightly transparent seam here. Algorithm: A+B(1-a)/b, A+B if a+b<1

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

exclusion - A more photographic form of difference.
Algorithm: A+B-2AB

from - Image A is subtracted from B. Algorithm: B-A

geometric - Another way of averaging two images.
Algorithm: 2AB/(A+B)

hard-light - Image B is lit up by a very bright and sharp light in the shape of image A. Algorithm: multiply if A<.5, screen if A>.5

hypot - Resembles the plus and screen operations. The result is not as bright as plus, but brighter than screen. Hypot works with values above 1. Algorithm: diagonal sqrt(A*A+B*B)

in - Only shows the areas of image A that overlap with the alpha of B. See also In. Algorithm: Ab

mask - This is the reverse of the in operation. Only shows the areas of image B that overlap with the alpha of A. Algorithm: Ba

matte - Premultiplied over. Use unpremultiplied images with this operation. See also Matte.
Algorithm: Aa+B(1-a) (unpremultiplied over)

max - Takes the maximum values of both images. See also Max. Algorithm: max(A,B)

min - Takes the minimum values of both images. See also Min. Algorithm: min(A,B)

minus - Subtracts B from A. Algorithm: A-B

multiply - Multiplies the values but stops two negative values from becoming a positive number. See also Multiply.
Algorithm: AB, A if A<0 and B<0

out - Only shows the areas of image A that do not overlap with the alpha of B. See also Out. Algorithm: A(1-b)

over - This is the default operation. Layers image A over B according to the alpha of image A. Algorithm: A+B(1-a)

overlay - Image A brightens image B.
Algorithm: multiply if B<.5, screen if B>.5

plus - The sum of image A and B. Note that the plus algorithm may result in pixel values higher than 1.0. See also Plus. Algorithm: A+B

screen - If A or B is less than or equal to 1 the screen, else use the maximum example. Similar to plus. See also Screen. Algorithm: A+B-AB if A and B between 0-1, else A if A>B else B

soft-light - Image B is lit up. Similar to hard-light, but not as extreme. Algorithm: B(2A+(B(1-AB))) if AB<1, 2AB otherwise

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

under - This is the reverse of the over operation. Layers image B over A according to the matte of image B. Algorithm: A(1-b)+B

xor - Shows both image A and B where the images do not overlap. Algorithm: A(1-b)+B(1-a)

Video colorspace

sRGB

disabled

When enabled, colors are converted to the default 8-bit colorspace (ProjectSettings > LUT > 8-bit files) before doing the composite and results are converted back to linear afterwards.

alpha masking

screen_alpha

disabled

When enabled, the input images are unchanged where the other image has zero alpha, and the output alpha is set to a+b-a*b.

When disabled, the same math is applied to the alpha as is applied to the other channels.

Note:  This option is disabled on operations where it makes no difference or PDF/SVG specifications says it should not apply.

set bbox to

bbox

union

Sets the output bounding box type and any data outside this region is clipped off:

union - Resize the output bbox to fit both input bboxes completely.

intersection - Use only those parts of the image where the input bboxes overlap.

A - Use input A’s bbox.

B - Use input B’s bbox.

metadata from

metainput

B

Sets which input’s metadata is passed down the node tree.

Note:  When metadata from is set to All and there are keys with the same name in both inputs, keys in B override keys in A.

range from

rangeinput

B

Sets which input's range is passed down the node tree.

A channels

Achannels

rgba

Sets the channels from the A input(s) to merge with the B channels, and which channel to treat as the A alpha.

Note:  Setting A channels to none is the same as black or zero.

B channels

Bchannels

rgba

Sets the channels to use from the B input, and which channel to treat as the B alpha.

output

output

rgba

Sets the channels to which the merge of the A and B channels are written.

also merge

also_merge

none

Sets the channels that are merged in addition to those specified in the A channels and B channels controls.

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 image at 0 and the full merge at 1.

Step-by-Step Guides

Layering Images Together with the Merge Node

Video Tutorials