Nodes/opencv-comfyui/OpenCV flipND_1
ComfyUI Node

OpenCV flipND_1

Same axis flip, second stub

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV flipND_1
  • src
  • dst
  • nparray
axis

flipND_1 is the mirror image of flipND_0 - literally and otherwise. It's the second auto-generated overload stub for cv2.flipND, and in the current release the two are identical: same inputs, same output, same code. If you see both in the node menu, nothing is broken. Pick either.

The pack generates one node per OpenCV overload, numbered _0, _1, and so on. For flipND, the two signatures that OpenCV's type stubs declare got filtered down to the same thing, so you get a duplicate. It's the same story as flip_0/flip_1 and fitLine_0/fitLine_1 - this is a generated pack, and duplication is one of its seams.

What the node does

It flips an array around a given axis using OpenCV's flipND. For 2D images:

  • src (NPARRAY) - the image to flip, converted from Comfy IMAGE via Image2Nparray.
  • axis (INT) - 0 flips vertically (upside down), 1 flips horizontally (mirror), -1 flips both. Deeper axes exist for non-image arrays.
  • dst (NPARRAY, optional) - the usual ignored out-parameter.

Output is nparray, the flipped array. Back into the image path it goes through Nparrays2Image.

Why bother with flipND at all when flip exists? Clearer semantics - you type an axis number instead of decoding flipCode's backwards convention - and it generalizes to arrays with more than two dimensions. For everyday mirroring on a single image, it behaves identically to flip.

Installing

Part of geroldmeisinger/opencv-comfyui. ComfyUI Manager: search "opencv-comfyui". Or:

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

Restart ComfyUI. requirements.txt installs opencv-contrib-python, numpy, and torch.

Common issues

The pack's usual suspects: Image2Nparray is single-batch only, remember the IMAGE → Image2Nparray → … → Nparrays2Image chain, and mind the BGR/RGB split between OpenCV and Comfy.

flipND-specific: it needs OpenCV 4.6+, so an ancient opencv-contrib-python gives AttributeError: module 'cv2' has no attribute 'flipND' - upgrade the package. And if you hit Cannot import name 'guidedFilter' from 'cv2.ximgproc' on install, that's the README's documented OpenCV package conflict; clean up the duplicate installs and retry.

That's the whole node. It's a simple, reliable flip with an axis spelled out - the kind of thing you don't think about after the first use. The only surprise is the duplicate staring back at you in the menu, and now you know why it's there.

Categoryimage/OpenCV

Inputs (3)

NameTypeDefaultDescription
srcNPARRAY
axisINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY