OpenCV flipND_0
Flip an image around a named axis, not a magic number
- src
- dst
- nparray
flipND_0 is OpenCV's newer, friendlier flip. Where the classic flip makes you remember that 0 means vertical and 1 means horizontal, flipND - "ND" for N-dimensional - just takes an axis number and mirrors the array around it. Same job, less cursed interface.
The thing is, for a normal 2D image the two functions end up doing the same thing with the same axis values. axis=0 flips along the row axis (upside down), axis=1 flips along the column axis (left-right mirror), and axis=-1 flips both. So why does this node exist? Because flipND is the generalization - it works on arrays with more than two dimensions, which is how you end up flipping a batch of frames or a multi-channel volume in one call. In ComfyUI practice you're almost always on 2D images, so this is mostly "the flip node with axis spelled out" - and that's genuinely less confusing than flipCode.
It's one of the simple, deterministic pixel ops in this pack, in the same "milliseconds, no model, no seed" bucket as every other post-processing primitive. Use it to mirror a frame, fix a backwards generation, or build that live-mirror effect.
Inputs and outputs
- src (
NPARRAY) - the image or array to flip; route a ComfyIMAGEthroughImage2Nparrayfirst. - axis (
INT) - which axis to flip around.0vertical,1horizontal,-1both. For higher-dim arrays,2,3, … flip deeper axes. - dst (
NPARRAY, optional) - OpenCV out-parameter; per the README, ignore it.
Output is nparray - the flipped array, typically fed into Nparrays2Image.
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. The pack's requirements.txt installs opencv-contrib-python plus numpy and torch; bare installs may need pip install opencv-contrib-python.
Common issues
Same pack-wide rules as always: Image2Nparray needs batch_size==1, the pipeline is IMAGE → Image2Nparray → this → Nparrays2Image, and OpenCV's BGR vs Comfy's RGB means you keep the color conversions straight. Feed this node a raw Comfy tensor and it'll complain about types.
One caveat specific to flipND: it's a newer OpenCV function (4.6+), so if you're running a genuinely ancient opencv-contrib-python, the node may throw AttributeError: module 'cv2' has no attribute 'flipND'. Upgrade OpenCV and it goes away. And note the README's known package-conflict error - if you ever see Cannot import name 'guidedFilter' from 'cv2.ximgproc', you have clashing OpenCV packages and need to clean your install.
Otherwise, this is the flip node to reach for when you'd rather type an axis than remember a magic number. For 2D work flip_0/flip_1 are equivalent; this one just says what it means.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| src | NPARRAY | — | |
| axis | INT | — | |
| dstopt | NPARRAY | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| nparray | NPARRAY | — |