Nodes/zsq_prompt/imagesSplitImage
ComfyUI Node

imagesSplitImage

Pull individual frames out of a small batch

By windfancy·Created 2 years ago·Updated 5 months ago· 2
imagesSplitImage
  • images
  • image1
  • image2
  • image3
  • image4
  • image5

imagesSplitImage from the zsq_prompt pack does one thing: it takes a batch of images and splits it along the batch dimension into individual frames, giving you up to five separate IMAGE outputs (image1 through image5). If you've generated a grid of four variations and wished you could grab each one separately without reaching for a Get Image From Batch node and typing indices - this is that, minus the typing.

How it works

Under the hood it's a single torch.chunk(images, len(images), dim=0): split the batch into one tensor per frame, each of batch size 1. A batch of four becomes four single-image tensors on image1image4. There's no cropping, no grid detection, no resizing - it's purely a batch-unpacking operation.

The catch that defines the node: it declares exactly five outputs. Feed it a batch larger than five and the number of chunks won't match the five output slots, which is the kind of thing that trips ComfyUI up. Treat this as a node for batches of five or fewer.

Inputs and outputs that matter

  • images - the IMAGE batch to split.
  • Outputs: image1image5 - individual frames, in batch order. Unused outputs stay unwired, so a 3-frame batch works fine with only image1image3 wired.

Where it fits

  • Grid work. Generated a 2×2 batch and want to process one cell as a controlnet reference while the others just preview? Split, then wire only what you need.
  • Selective processing. After a batch of variations, route frame 2 through an extra img2img pass without touching the others.
  • Debugging. When a downstream node is misbehaving on a multi-frame tensor, splitting lets you feed one clean frame at a time to isolate the problem.

For bigger batches, or for pulling a specific index out of many, you're better off with a batch-selection node that takes an index input (core ComfyUI has Get Image From Batch). This node is the "I have ≤5 frames" convenience tool.

Installing zsq_prompt

Shared pack install. ComfyUI Manager → search zsq_prompt → install, restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/windfancy/zsq_prompt

Restart ComfyUI. The pack drags in heavy dependencies (transformers, opencv-python, opencv-contrib-python, scikit-image, timm, onnx, ultralytics) even though this node is a torch one-liner. If Manager flags "conflicting with zsq_prompt" on a downloaded workflow, that's dependency-overlap noise; only meaningful once the pack is actually installed. No model files needed.

Gotchas

  • Five outputs means a five-frame ceiling. A bigger batch will mismatch the node's output count and error out - keep batches ≤ 5 or use a real batch-index node.
  • The outputs are ordered by batch position, and empty slots just stay unwired. No padding is created.
  • It splits the batch dimension, not a spatial grid. A single 4-panel image is one frame, not four - you'd need imageCrop for that.
CategoryZSQ/Image

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (5)

NameTypeDescription
image1IMAGE
image2IMAGE
image3IMAGE
image4IMAGE
image5IMAGE