ComfyUI Node Runs on cloud

ArithmeticBlend

Add, subtract, difference, and one mode that's a trap

By EllangoK·Created 3 years ago·Updated 2 years ago· 256
ArithmeticBlend
  • image1
  • image2
  • IMAGE
blend_mode

Sometimes you don't want to blend two images so much as do math to them. ArithmeticBlend is the raw-tool version of blending: it takes two images and adds, subtracts, or takes the difference between them, pixel by pixel. It's not for making pretty composites - it's for the tricks that arithmetic enables, like isolating what changed between two versions of a shot, or building the input for a mask-based workflow.

How it works

Each mode is a straightforward tensor operation, and the result is clamped to 0–1:

  • add - image1 + image2. Anything bright in either one blows out toward white. Good for light accumulation, or layering two renders to composite their highlights.
  • subtract - image1 - image2. Bright where image1 is bright and image2 is dark; black where image2 wins. The classic "what's different" tool - subtract a clean version from a modified one and you get a change map.
  • difference - abs(image1 - image2). Same idea but symmetric: it doesn't matter which image is which, the output is bright wherever they disagree. Great for spotting artifacts between two seeds or two upscalers.
  • divide - here's the trap. In the shipped source, divide builds a "safe" denominator from a copy of image1, not image2, then divides image1 by it. Net effect: you mostly get a flat near-white frame. Treat it as not implemented and use the other three - you won't lose anything.

The inputs are just image1, image2, and the blend_mode enum. Output is a single IMAGE.

Install

ArithmeticBlend is one of ~22 nodes in ComfyUI-post-processing-nodes.

  • ComfyUI Manager: search "post processing nodes", install, restart.
  • Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes

Restart after. No requirements.txt or downloads - plain torch tensors. It's under postprocessing → Blends in the node menu.

How people actually use it

The difference mode is the sleeper hit here. Run the same prompt twice with different seeds, take the difference, and you get a soft grayscale map of where the images disagree - feed that through a blur and you've got a rough "areas of uncertainty" mask for targeted re-rolls. Subtract works the same trick for before/after comparisons. Just remember: the two images need to be the same dimensions, because unlike the pack's Blend node, there's no auto-resize here.

Categorypostprocessing/Blends

Inputs (3)

NameTypeDefaultDescription
image1IMAGE
image2IMAGE
blend_modeCOMBO4 options: add, subtract, difference, divide

Outputs (1)

NameTypeDescription
IMAGEIMAGE