Nodes/opencv-comfyui/OpenCV broadcast_1
ComfyUI Node

OpenCV broadcast_1

The same numpy-style stretch, second overload, same rough edges

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV broadcast_1
  • src
  • shape
  • dst
  • nparray

OpenCV broadcast_1 is broadcast_0's duplicate overload - same function, same inputs, same quirks, and nothing you'd do in a workflow distinguishes them. opencv-comfyui mints a node per overload it finds in OpenCV's type stubs; cv2.broadcast has two, and here they both are. Choose one, ignore the other.

So what does broadcasting buy you? It's the numpy behavior of expanding a small array to a larger shape - stretching a single-row tint across every row, a small gradient across a whole image, a tiny weight pattern across a full frame - so it lines up for per-pixel math with a bigger array. It's a real, useful idea in array-land. The problem in this pack is the shape of the implementation: the generator typed the shape parameter as an NPARRAY, but cv2.broadcast wants a size descriptor, not an image. The node passes your wire through untouched, so you can't type a target size into a widget - you feed it an array whose shape you're willing to adopt. That works in a narrow pattern, and it's exactly the kind of "ugly, complex to use" friction the README warns about up front.

Inputs

  • src - the NPARRAY to broadcast (the small array).
  • shape - NPARRAY; the target shape, awkwardly expressed as an array.
  • dst (optional) - out-parameter; leave unwired.

Output: one nparray, src expanded to the target shape.

Should you bother?

Only if you're already doing manual array math in the graph - building per-pixel weights, channel gymnastics - and you specifically want numpy-style expansion as a node. For "fill this region with a gradient or constant," the stock ComfyUI primitives and image-fill nodes are far less hassle. And if the node throws a type assertion, that's the shape socket doing its thing (an image port where a size belongs); it's a generation artifact, not a mistake you made.

Install

Same as every node in the pack: ComfyUI Manager → opencv-comfyui, or clone https://github.com/geroldmeisinger/opencv-comfyui into ComfyUI/custom_nodes, restart. Needs opencv-contrib-python. Pack-wide rules apply unchanged: batch size 1, NPARRAY in/out, you own the color conventions.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
shapeNPARRAY
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY