Image Count
How many images? Only if they're handed to it as a list
- images
- count
Sometimes a workflow needs to know how many images it's holding - not to show you, but to feed a condition, a loop, or a dynamic prompt. That number has to come from somewhere, and core ComfyUI doesn't hand you a "count this batch" node. ImageCount is one of the four utility nodes in the ComfyUI-DeanLogic pack (single author, single commit from mid-2025, MIT, no dependencies), and it exists to turn an IMAGE input into an INT output.
The logic reads exactly like a first attempt at a counting node: if the input is None, not a list, or an empty list, return 0; otherwise return len(images). That's the whole implementation - one small function, no settings, nothing to tune.
Here's the catch that will absolutely trip you up, because it's invisible until the node returns. In ComfyUI the IMAGE type on a wire is normally a batched tensor, not a Python list. LoadImage hands you a tensor of shape (1, H, W, C); VAE Decode hands you a batched tensor. isinstance(images, list) is False for all of those, so this node short-circuits straight to the 0 branch. Feed it a normal image and it reports 0 every single time - which reads as "broken," but it isn't. The node only ever counts list-style image inputs, the kind a handful of custom nodes produce or that show up in list-expansion mode.
So the honest use case is narrower than the name suggests: if something upstream is handing you actual Python lists of image tensors, this gives you the length; if you're feeding it ordinary LoadImage output, expect a constant 0 and don't chase it as a bug. The one input is images (IMAGE), the one output is count (INT), and you'd typically wire that INT into a comparison or a dynamic prompt.
Installing is trivial, since it ships in the same pack as the two DeanLogic switches. In ComfyUI Manager, search "ComfyUI-DeanLogic" and install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/MartinDeanMoriarty/ComfyUI-DeanLogic
Restart and it lands under the "DeanLogic" menu category. No pip step, no models to fetch.
If what you actually need is a batch size for conditional logic, consider the pack's sibling IntCompare instead: it takes two INTs and a comparison (<, >, ==) and returns a BOOLEAN, which wires straight into a switch. Count a list, compare it, branch - that combo is where this pack starts to earn its keep, even if each individual node is a shrug.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| count | INT | — |