Nodes/zsq_prompt/Image Count
ComfyUI Node

Image Count

How many images are actually in that batch? This node tells you

By windfancy·Created 2 years ago·Updated 5 months ago· 2
Image Count
  • images
  • count

If you've ever wired a batch of images into something and wondered "wait, how many frames am I actually processing here?", this is the node for you. Image Count (imageCount) takes an IMAGE input and returns the size of the batch - one integer telling you how many individual images are stacked inside that tensor. That's the entire job, and it does it well.

It's from zsq_prompt, a grab-bag pack by windfancy that's part prompt styler, part image utilities, part loader convenience. The pack gets installed as a single unit, so this node comes bundled with a lot of other stuff you may never touch. That's fine - this one is worth knowing.

How it works

In ComfyUI, an "image" isn't usually one picture. It's a tensor shaped [batch, height, width, channels], so a grid of four generated images is one tensor with batch size 4. imageCount just reads images.size(0) - the batch dimension - and hands it to you as an INT. No resizing, no sampling, no decoding. It's instant, and it can't crash from a weird image because it never looks at the pixels.

The inputs and outputs that matter

  • images - any IMAGE wire. Feed it the output of a sampler, a Load Image node, or whatever's mid-workflow.
  • count (INT) - the number of images in the batch. That's your only output.

Where you'd actually use it

The honest answer: this is a plumbing node. Its real value shows up when you're doing conditional logic or batch work. A few places it earns its keep:

  • Gate a KSampler or a save node on whether a batch is non-empty, so an empty batch doesn't silently waste a pass.
  • Feed the count into a math node to compute per-batch values (like how many tiles to expect from a tiler).
  • Debug. When something downstream is acting like it got ten images instead of one, seeing "count = 10" in a Show Text / Show INT node tells you where the problem started.

Because it's a pure read, it never changes the graph's data - you can tap it off any image wire without worrying about side effects.

Installing zsq_prompt

Everything in this pack ships together. Easiest path: ComfyUI Manager → "Install Custom Nodes" → search zsq_prompt → install, then restart ComfyUI. Or, old-school:

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

Then restart ComfyUI. The pack's requirements.txt pulls in real dependencies - transformers, opencv-python, opencv-contrib-python, scikit-image, timm, onnx, ultralytics. That's a chunky install and it overlaps with what ReActor-style packs need, which is why ComfyUI Manager sometimes shows a scary "conflicting with zsq_prompt" warning when you load a workflow that references these nodes. If you haven't installed the pack, that message is misleading - you can ignore it and just install. If you have installed it, expect the heavy deps to coexist with other packs that use the same libraries.

No model files are required for this node. The styler data and image utilities all ship inside the repo.

Gotchas

  • It counts frames in the batch, not pixels and not "images" in any artistic sense. A batch of five is 5.
  • If you're expecting a node that tells you image dimensions, that's a different node (Image Size also exists in this pack). This one is strictly the count.
CategoryZSQ/Image

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
countINT