OpenCV multiply_1
Multiply_1 — the saturating multiply twin (identical, just numbered differently)
- src1
- src2
- dst
- nparray
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 (
scalebelow 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 -
src1andsrc2must share a dtype; mixingCV_8UandCV_32Ffails. - No visible change - check
scaleand thatsrc2isn't identical-with-scale-1 (that's a subtle square). - Which variant -
_0. Identical, but_0matches the docs.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| src1 | NPARRAY | — | |
| src2 | NPARRAY | — | |
| scale | FLOAT | — | |
| dtype | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |