Nodes/opencv-comfyui/OpenCV multiply_1
ComfyUI Node

OpenCV multiply_1

Multiply_1 — the saturating multiply twin (identical, just numbered differently)

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

multiply_1 is the exact duplicate of multiply_0: same src1/src2/scale/dtype inputs, same optional dst, same nparray output, same cv2.multiply under the hood. For the full guide - saturating vs wraparound math, the constant-multiply gotcha, the dtype choices - read the _0 article. This one covers what's different (nothing) and why it exists (a parser quirk).

The short version

cv2.multiply computes dst = saturate(scale * src1 * src2), element by element. The "saturate" is the whole point: values clamp at 255 instead of wrapping around like numpy's * does on uint8. Practical uses in ComfyUI:

  • Dim or boost an image (scale below or above 1.0, or self-multiply).
  • Blend a light pass with a mask.
  • Apply gain before further processing.

dtype=-1 keeps the input type, which is what you want for 8-bit images. Leave dst unconnected.

Why there are two of them

geroldmeisinger/opencv-comfyui auto-generates a node per OpenCV overload, and cv2.multiply is declared for both MatLike and UMat. Both collapse onto the pack's single NPARRAY type, so multiply_0 and multiply_1 are functionally identical. Same story as minMaxLoc_0/1, moments_0/1, morphologyEx_0/1. Whenever two numbered variants share identical info_schema inputs, they're the same node - pick _0.

The one trap worth repeating

To multiply by a constant, you need an NPARRAY containing that constant - and there's no easy "constant array" node in this pack. So either self-multiply (same image into both, lower scale) or use two real images. Wiring a bare float into src2 won't work; it expects an array.

Installing

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

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

restart. Dependency: opencv-contrib-python.

Pipeline

IMAGE → Image2Nparray → multiply_1 → Nparrays2Image → IMAGE. Image2Nparray flips RGB→BGR and only accepts batch_size==1. Keep both inputs the same dtype or you'll hit a type error.

Troubleshooting

  • Type mismatch - src1 and src2 must share a dtype; mixing CV_8U and CV_32F fails.
  • No visible change - check scale and that src2 isn't identical-with-scale-1 (that's a subtle square).
  • Which variant - _0. Identical, but _0 matches the docs.
Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
src1NPARRAY
src2NPARRAY
scaleFLOAT
dtypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY