Nodes/opencv-comfyui/OpenCV blendLinear_1
ComfyUI Node

OpenCV blendLinear_1

The twin of blendLinear_0 — same blend, second overload

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV blendLinear_1
  • src1
  • src2
  • weights1
  • weights2
  • dst
  • nparray

This is the moment the auto-generated pack's naming bites you. OpenCV blendLinear_1 and OpenCV blendLinear_0 are the same function. OpenCV's Python API declares two overloads of cv2.blendLinear with slightly different signatures, and the generator - which extracted 635 top-level functions from OpenCV's type stubs and numbered the overloads - emitted both as separate nodes. For anything you'd actually do in a ComfyUI workflow, they are interchangeable. Pick one, bookmark it, forget the other exists.

So what does it do? blendLinear is the per-pixel weighted blend: result = src1 * weights1 + src2 * weights2. The two weight images give every pixel its own blend factor, which is what makes it the go-to for seam-free compositing - fading an inpainted region into its surroundings, blending a subject into a new background along a gradient, stitching tiles so the edges agree. This is the deterministic pixel-math layer of post-processing (per the KB's own framing, "almost none of this is AI"), and blendLinear is the primitive that layer runs on when a constant alpha would leave a visible join.

Inputs

  • src1 / src2 - the two NPARRAY images to blend. Same size, same depth.
  • weights1 / weights2 - the per-pixel weight NPARRAYs. Same size as the sources; a single-channel weight is fine. This is where all your creative control lives - a gradient weight, a mask, a falloff you built elsewhere.
  • dst (optional) - out-parameter; leave unwired.

Output: one blended nparray, which you feed to Nparrays2Image to preview.

Install

Same as every node in this pack: ComfyUI Manager → search opencv-comfyui, or clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes and restart. It needs opencv-contrib-python (you almost certainly have it already).

The honest caveats

Everything in the README's "Expect dragons!" warning applies: NPARRAY in means BGR, 0–255, uint8 - convert with Image2Nparray; batch size 1 only. And keep weights1 + weights2 sensible per pixel or the output clips. If you came here wondering which of the two blend nodes to use, the answer is: whichever one you remember first. The _0/_1 distinction is a quirk of how the pack was generated, not a feature.

Categoryimage/OpenCV

Inputs (5)

NameTypeDefaultDescription
src1NPARRAY
src2NPARRAY
weights1NPARRAY
weights2NPARRAY
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY