Nodes/opencv-comfyui/OpenCV add_1
ComfyUI Node

OpenCV add_1

OpenCV add_1

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV add_1
  • src1
  • src2
  • dst
  • mask
  • nparray
dtype

add_1 is add_0 with a different suffix. Same inputs - src1, src2, dtype, optional dst and mask - same saturating dst = src1 + src2, same single nparray output. opencv-comfyui generated a numbered node per OpenCV overload and these overloads share a signature, so you're looking at two entries for one function. Use either; nothing changes.

What it does

Per-pixel addition that clamps instead of wrapping: any result over 255 (for uint8) is pinned to 255, so you never get the "bright plus bright equals black" surprise of modular arithmetic. That makes it the safe choice for exposure stacking, combining aligned images, or any time you want the sum without overflow artifacts.

The inputs that matter

  • src1 / src2 (NPARRAY) - the images to add; same size and type.
  • dtype (INT, required) - -1 for "same as inputs", which is what you want 99% of the time.
  • dst (NPARRAY, optional) - out-parameter; skip it per the README.
  • mask (NPARRAY, optional) - restrict addition to nonzero mask pixels.

Output: one nparray - the saturated sum.

Choosing between the twins

You don't. This is the rare spot in ComfyUI where there are genuinely two identical nodes, and the only real advice is to not let the duplication confuse you into thinking _1 is an "advanced" variant. It isn't. If you need weighted blending instead of raw addition, that's addWeighted_0/addWeighted_1; if you need non-saturating accumulation across frames, that's the accumulate family. For "add two images, clip cleanly", this node - or its twin - is the tool.

Installing opencv-comfyui

ComfyUI Manager → search "opencv-comfyui", or:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui

Restart ComfyUI. Dependency: opencv-contrib-python (usually already present).

Gotchas

  • Size match required - mismatched src1/src2 assert.
  • Batch_size == 1 - slice with ImageFromBatch.
  • Saturating, not wrapping - if you wanted modular sum, that's the bitwise_* family instead.
Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
src1NPARRAY
src2NPARRAY
dtypeINT
dstoptNPARRAY
maskoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY