Nodes/opencv-comfyui/OpenCV randShuffle_1
ComfyUI Node

OpenCV randShuffle_1

It's the same node

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV randShuffle_1
  • dst
  • nparray
iterFactor

randShuffle_1 is a duplicate of randShuffle_0 - same cv2.randShuffle call underneath, same inputs, same scrambled output. This pack auto-generates a node per OpenCV overload stub, and the two stubs for randShuffle turned out identical, so the menu gets two nodes that do exactly the same thing. Which one you use is irrelevant; knowing that saves you the five minutes I spent double-checking.

For what it's worth: the node randomly swaps pairs of pixels in an image, repeatedly, until the structure is destroyed. Same colors afterward, no meaningful arrangement - the histogram is preserved, the picture is not. iterFactor controls how many swaps happen (it multiplies the array's element count), so 1.0 is partial scrambling and higher values are full static.

Inputs

  • dst - NPARRAY. In-place shuffle: what you pass in defines the shape, then gets mangled.
  • iterFactor - float. Swap count multiplier. Higher = more destroyed.

Output is a single nparray of the same dimensions, same pixels, new positions - BGR, so it wants Nparrays2Image on the way out.

Honest expectations

Three things to know before you build around it. First, this is fine-grained static, not a blocky pixelation effect - if that's what you were picturing, you want a downscale-up-resize trick instead. Second, there's no seed input; the shuffle uses OpenCV's global RNG, so results vary between runs and you can't lock a "nice" scramble. Third, and bluntly: most ComfyUI workflows have zero use for this node. It's here because the pack wraps every top-level OpenCV function, not because it's a workhorse. It's a curiosity, and it's fine to treat it as one.

Install

Standard pack install - no models, just OpenCV:

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python

Or search "OpenCV" in ComfyUI Manager and restart; it lives under image/OpenCV. batch_size==1 only, and a guidedFilter import error at load means conflicting OpenCV packages (fix is linked in the README).

Use _0 or _1, whichever your muscle memory finds first. Both do the same shuffle, and both are more party trick than production tool.

Categoryimage/OpenCV

Inputs (2)

NameTypeDefaultDescription
dstNPARRAY
iterFactorFLOAT

Outputs (1)

NameTypeDescription
nparrayNPARRAY