Nodes/Nilor Nodes by Nilor Corp/๐Ÿ‘บ Shuffle Image Batch
ComfyUI Node

๐Ÿ‘บ Shuffle Image Batch

Shuffle the order of an image batch, reproducibly, with one seed

By nilor-corpยทCreated 2 years agoยทUpdated 5 months agoยท 6
๐Ÿ‘บ Shuffle Image Batch
  • images
  • images
โ—„seed0โ–บ

Sometimes the fix for a weird result is just "the order was wrong." ComfyUI processes batches in order, and when a batch gets reused across passes - training-data style workflows, prompt-variation sweeps, feeding a batch through an upscaler twice - the same images keep meeting in the same pairs. ๐Ÿ‘บ Shuffle Image Batch reorders your batch so that doesn't happen, and it does it reproducibly: one seed, one shuffle, every time.

Under the hood it's as simple as it gets. The node generates a random permutation of the batch indices with torch.randperm, seeded from your seed, then indexes the batch with it. Same seed โ†’ same order, always, which means you can shuffle for variety but still reproduce a run exactly when you need to. That seedability is the difference between this being a debugging tool and a data pipeline tool. Set a fixed seed, and the shuffle becomes part of your workflow's identity - the same input batch always gets the same reshuffle, so results stay comparable across runs. Change the seed and you get a fresh arrangement.

It also plays well with the rest of this pack's batch utilities. Shuffle a batch before tiling it up with Repeat & Trim, and you get a pseudo-random spread instead of a periodic tile. Wire a seed from the pack's ๐Ÿ‘บ User Input (Seed) node and you can randomize it from the UI each pass. The pieces are meant to chain.

Inputs and output

  • images - the IMAGE batch to reorder.
  • seed - shuffle seed, 0 to a very large number.
  • images (output) - the same images, same count, different order.

Installing it

Part of Nilor Nodes (nilor-corp/nilor-nodes):

cd ComfyUI/custom_nodes
git clone https://github.com/nilor-corp/nilor-nodes

or ComfyUI Manager โ†’ search "Nilor Nodes" โ†’ install โ†’ restart. No model downloads. The README lists Kijai's comfyui-kjnodes as a prerequisite and the pack pulls a heavy dependency set (boto3, fastapi, huggingface_hub, openexr) regardless - par for the course with this pack.

Troubleshooting

The source validates the batch is non-empty and 4D, so an unbatched image or empty tensor errors immediately. The only real gotcha is expectation: a shuffle is a permutation, not a change - every image still appears exactly once, and a batch of 1 or 2 "shuffles" into itself. And a shuffle gives you variety, not new data; if you wanted more images than you started with, this isn't the node. As with everything in this pack, there's no community support to lean on - the ๐Ÿ›‘ Nilor-Nodes error prefixes and the source are what you have. One nice property to exploit: because the seed fully determines the order, two identical runs with the same seed are bit-for-bit identical, which is exactly what you want when you're hunting down a non-deterministic bug upstream.

CategoryNilor Nodes ๐Ÿ‘บ/Utilities

Inputs (2)

NameTypeDefaultDescription
imagesIMAGEโ€”
seedINT00โ€“9007199254740991โ€”

Outputs (1)

NameTypeDescription
imagesIMAGEโ€”