ImageCount
Get the number of images in a batch
- images
- count
This is as small as nodes get: feed it an image batch, it tells you how many images are in it. That's the entire function. No settings, no dropdown, one input and one number out. If you're looking for something more sophisticated, you're overthinking it - this node exists purely to answer "how many?" so the rest of your graph can act on the number.
Why you'd actually want this
A ComfyUI batch is just a stack of images riding on one wire, and there's no built-in way to see how many are in it without opening a Preview and manually counting thumbnails. easy imageCount turns that into a number you can wire somewhere useful:
- Drive an
easy imageIndexSwitch's upper bound so you don't point the index past the end of the batch. - Feed a loop's iteration count so a
forloop processes exactly as many images as arrived, no more, no fewer. - Gate a downstream step with a comparison (
easy compare,easy ifElse) - e.g. "only run the grid-save step if count equals 4." - Just sanity-check that a batch-producing node upstream (a batch loader, an
easy imageSplitGrid, an API call) actually returned what you expected before you spend GPU time on the rest of the graph.
It's the kind of node you don't think about until a workflow silently processes 3 images when you expected 12, and then it's the first thing you drop in to find out where the count went wrong.
How it works
There's no processing here - it reads the batch dimension of the incoming IMAGE tensor and reports the size. Trivial to implement, which is exactly the point: it's a one-line utility, not a feature.
The inputs and outputs that matter
images(IMAGE) - the batch you want counted. The only input.count(INT, output) - how many images were in it.
That's the whole node.
Installing it
ComfyUI Manager: search ComfyUI Easy Use, install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use
then install.bat on Windows or pip install -r requirements.txt, and restart. No models, no extra dependencies for this node - it ships with the base pack.
Common issues & troubleshooting
The count doesn't match what you expected. This almost always means the upstream node isn't producing what you think it is. A common trip-up: some nodes output a list of separate IMAGE items rather than a single batch tensor, and easy imageCount reads the batch dimension of one tensor - if what's actually arriving is a list of single-image batches, you'll get 1 every time instead of the total. If your count looks stuck at 1 no matter what feeds it, check whether the upstream node is list-type output rather than a true batch, and reach for easy imageListToImageBatch first to collapse it into one batch before counting.
Wiring it into a loop's max-iteration input. Works fine, and it's the most common real use - just remember the count is captured once, at the point this node runs. If your batch size can change mid-graph (rare, but possible with conditional branches upstream), the count reflects whatever arrived on that particular run, not a live value.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| count | INT | — |