Nodes/ComfyUI-Majoor-ImageOps/〽️ Image Ops Merge
ComfyUI Node

〽️ Image Ops Merge

Blend two images like a compositor — nineteen blend modes and the math to back them

By MajoorWaldi·Created 8 months ago·Updated 8 days ago· 11
〽️ Image Ops Merge
  • A
  • B
  • mask
  • image
  • mask
bypassfalse
modeover
mix1.00
foreground_fitstretch
blend_spacelinear
invert_maskfalse

ImageOps Merge is the two-input compositor of the ComfyUI-Majoor-ImageOps pack, and it's the node that answers "how do I put this thing over that thing" in nineteen different ways. It takes a background layer A and a foreground layer B and blends them with a proper compositing blend mode - over, add, multiply, screen, overlay, soft_light, difference, lighten, darken, color_dodge, color_burn, exclusion, subtract, max, min, vivid_light, pin_light, hard_mix - plus mix for opacity and real linear-light math.

The settings that matter

  • mode - the blend. For actual compositing of a subject over a background, over is standard alpha compositing (and it respects the foreground's transparency, which is the one you'll reach for first). The rest are the creative/utility palette: add and screen brighten (light, glow, flare passes), multiply darkens and bakes shadows into a base, overlay/soft_light are the grain-and-texture-blending workhorses, difference is a debugging and stylization favorite.
  • mix (0–1) - overall opacity of the blend. 1 = full effect, 0 = just A. The "how strong is this comp" knob.
  • foreground_fit - how B is adapted to A's dimensions before blending: stretch (default), contain, cover, or none. If your layers don't match size, this is what keeps it sane - contain fits B inside A without distortion, cover fills A.
  • blend_space - linear (default) or srgb. This is the compositor-grade detail: linear performs the blend math in gamma 1.0 space and converts back, which is how correct blend math actually behaves - screen and multiply look right, additive glows behave. srgb does it in the encoded space, which is faster and fine for quick looks. Leave it linear; it's the difference between "looks right" and "looks approximately right."

An optional mask (with invert_mask) limits the blend to part of the frame - so A shows through everywhere except where the mask says "use B here." Outputs are image and mask.

Where it fits

This is the pairing node for half the pack: composite a Corner Pin result over a scene, put a Keyer matte over a new background, lay Grain's output with soft_light. When your comp grows past two layers, graduate to ImageOps Comp - but for the vast majority of "blend these two things" moments, Merge is the right-sized tool.

Install

ComfyUI Manager (search "ComfyUI-Majoor-ImageOps"), or:

cd ComfyUI/custom_nodes
git clone https://github.com/MajoorWaldi/ComfyUI-Majoor-ImageOps

Restart and hard-refresh the browser (Ctrl+F5 / Cmd+Shift+R). No models, no extra deps.

The gotchas

The blend_space default of linear occasionally surprises people who expect the exact same result as a photo-editor's sRGB blend - the math differs, especially on overlay. If a blend looks subtly different from what you're used to, that's the explanation, and switching to srgb gives you the familiar result. Second: mismatched layer sizes under stretch distort the foreground by default - set foreground_fit to contain or cover if stretching is unwanted. And remember over needs B to actually carry alpha; a flat RGB image over A just covers it completely until you drop mix.

Categoryimage/imageops

Inputs (9)

NameTypeDefaultDescription
AIMAGE,VIDEOBackground Images/Video input.
BIMAGE,VIDEOForeground Images/Video input.
bypassBOOLEANfalse
modeCOMBOover12 options: over, add, multiply, screen, overlay, soft_light, +6
mixFLOAT1.000–1
foreground_fitCOMBOstretch8 options: stretch, contain, fit, letterbox, pad, none, +2
blend_spaceCOMBOlinear2 options: linear, srgb
invert_maskBOOLEANfalse
maskoptMASKOptional mask applied to the merged result

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK