Iterator Counter
A loop that counts steps instead of swapping images
- current_count
- is_finished
The other nodes in ComfyUI-Automation shuffle media through a list. Iterator Counter doesn't care about images at all - it just hands you a number that goes up by a fixed step on every loop pass, plus a flag that says "done." That sounds almost too simple to be useful, until you need to run the same pipeline N times with something changing each pass: an iterative upscale that does three refinement rounds, a denoise strength that creeps down over several passes, or a seed sequence you want to step through without babysitting the queue.
How it works
It runs on the exact same state machinery as the rest of the pack. The Iterator Signal node - the one that re-queues your workflow - bumps an index in a shared state dictionary keyed by your iterator_id. The Counter just reads that index and does the arithmetic: current_count = start + (index * step), and is_finished turns true when index + 1 hits max_iterations.
The important mental model: the Counter doesn't advance itself. It's a read-only display of the loop state. The Signal is what drives it forward, and it only advances when it sees a real image at the end of your chain. So the Counter isn't an alternative to the Signal - it's a companion for loops where you don't have a list of items to feed in.
The inputs and outputs that matter
iterator_id- the shared key, defaultcounter_iterator. Must match the Signal's id.start- where the count begins (integer, default 0).max_iterations- how many passes total (default 10). This is your loop length.step- how much the count increases per pass (default 1).reset- boolean that forces the index back to 0. Flip it once to restart.- Outputs:
current_count(an INT you can plug into anything that takes a number - seeds, CFG, controlnet strength) andis_finished(a boolean, which you'd wire into the Signal'sis_finishedinput to stop the loop).
Installing it
Shared install for the whole pack:
cd ComfyUI/custom_nodes
git clone https://github.com/franciscotorrado/ComfyUI-Automation
pip install -r requirements.txt
Then restart ComfyUI. Or use ComfyUI Manager and search "ComfyUI-Automation". No models to fetch; the only dependency is ffmpeg-python. (And yes, the README's install block still contains a placeholder your-repo URL - use the real one above.)
Common issues
The classic mistake is treating the Counter as a standalone loop driver. Wire one up by itself, hit run, and... the count sits at start and never moves, because nothing is re-queuing the graph. You still need an Iterator Signal in the workflow to make the loop tick. If your count never increments, check that the Signal is there, has the same iterator_id, and is receiving your final image with Auto Queue on.
Second, the state namespace is shared across the whole pack. If you reuse an iterator_id that a List elsewhere in the workflow already uses, the two nodes will fight over the same index - the List will skip items and the Counter will count wrong. Give every loop its own id.
Finally, is_finished only becomes true on the pass after the last one. If max_iterations is 5, you'll see is_finished go true while current_count reads your 6th value's position - that's expected, not a bug, and it's why the Signal should stop the loop when it sees that flag.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| iterator_id | STRING | counter_iterator | — |
| start | INT | 00–18446744073709550000 | — |
| max_iterations | INT | 101–18446744073709550000 | — |
| step | INT | 11–18446744073709550000 | — |
| reset | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| current_count | INT | — |
| is_finished | BOOLEAN | — |