Nodes/ComfyUI_Swwan/Image Add Multi (Swwan)
ComfyUI Node

Image Add Multi (Swwan)

Blend N images with add, subtract, multiply or difference

By aining2022·Created 10 months ago·Updated about 18 hours ago· 33
Image Add Multi (Swwan)
  • image_1
  • image_2
  • images
◄inputcount2►
◄blendingadd►
◄blend_amount0.50►

Straight tensor maths with a mixing knob

Image Add Multi takes two or more images and combines them arithmetically - add, subtract, multiply, difference - at a level you dial in with blend_amount. It's KJNodes' ImageAddMulti re-registered by the Swwan pack, and it's the bare-metal version of image blending: no masks, no alpha, no colour management, just ops on the pixels.

Where it's genuinely handy: difference as a diagnostic (compare two upscalers, two denoise settings, a control map against the output), multiply to darken or to use one image as a crude multiplier for another, and add for the layered-light tricks that a compositor would do with two exposure passes. All deterministic and instant, which is the whole appeal of pixel mathematics over another diffusion pass.

The inputs

  • inputcount - 2 to 1000, default 2. Raising it adds image_3, image_4… sockets via the pack's frontend script.
  • image_1, image_2 - required, plus the extras you expose.
  • blending - add, subtract, multiply, difference. Default add.
  • blend_amount - 0 to 1, step 0.01, default 0.5.

Output: a single images batch.

What the maths actually does

The loop folds the images pairwise, and the modes are not symmetrical in how they treat blend_amount:

  • add: image * blend_amount + new_image * blend_amount. Both operands get scaled, so at the default 0.5 you're adding two half-brightness images - which for mid-grey-ish inputs lands around where you started, and for bright inputs clips at white. This is why "add at 0.5" often looks like nothing happened and "add at 1.0" blows out.
  • subtract: same scaling, subtracted. Values can go negative, and nothing clamps them. Downstream nodes that assume 0–1 will misbehave; the output is honest raw maths.
  • multiply: (image * blend_amount) * (new_image * blend_amount), which means blend_amount is squared in effect. At 0.5 you're multiplying by 0.25 overall - the most common "why is it suddenly so dark" in this node.
  • difference: torch.sub(image, new_image). Note it ignores blend_amount entirely, and despite the name it's a signed subtraction, not an absolute difference. So the output has negative values wherever the second image was brighter, and moving the slider changes nothing at all. If you wanted true abs-diff, you'll need an extra step.

All of it is chained, so with four inputs at blend_amount 0.5 you're compounding those scale factors three times. Tune with two inputs, then extend.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
cd ComfyUI_Swwan
python -m pip install -r requirements.txt

Manager → ComfyUI Swwan, restart, hard-refresh the browser. This is torch arithmetic on the base requirements - no models, no optional pip packages.

Notes before you wire it up

Inputs must match in size. It's element-wise on tensors, so mismatched dimensions either broadcast in a way you didn't intend or error. Resize first; the pack has resize nodes for that.

The dynamic sockets come from a JS extension. If raising inputcount doesn't add a socket, the frontend script isn't loaded - force-refresh and check for /extensions/ComfyUI_Swwan/ in the network tab. The pack's script also refuses to shrink below your highest connected input, so it won't silently delete a wire you're using.

Nothing is clamped, so watch your range. Feeding an unclamped result into a save node is usually fine; feeding it into something that assumes 0–1 (a VAE encode, most mask maths) is not. For the difference-as-diagnostic workflow specifically, drop a normalise or remap node after this one and you'll actually be able to see the delta instead of a mostly-black frame with a few white pixels. And it doesn't change any colour space or gamma - these are raw tensor ops, which is the point and also the reason a "multiply" here doesn't look like a Photoshop multiply.

CategorySwwan/Advanced/Image

Inputs (5)

NameTypeDefaultDescription
inputcountINT22–1000—
image_1IMAGE—
image_2IMAGE—
blendingCOMBOadd4 options: add, subtract, multiply, difference
blend_amountFLOAT0.500–1—

Outputs (1)

NameTypeDescription
imagesIMAGE—