Counter
A number that steps forward every time the graph runs
- number
- now_number_text
A counter that actually counts. Feed it a start and end number, and every time the graph runs it outputs the next number in the range, wrapping back to the start when it hits the end. That's the whole node, and it's the missing piece for a lot of batch workflows: you can feed it into Samin Load Image Batch's image_number input to walk a folder one image per run, or into anything else that wants a changing integer - a seed, a style index, a batch position.
How it works
It keeps the current position in the pack's small JSON store (was_suite_settings.json) under a key you name via label. Give it start_number 0, end_number 9, and label "my scan", and each execution returns 0, then 1, then 2... up to 9, then back to 0. The label matters twice: it's how the node knows which counter to advance, and it's how you reset - change the label and the counter restarts from start_number. The node marks itself as always-changed, so ComfyUI re-runs it every queue execution instead of caching the result and returning the same number forever.
Inputs and outputs
- start_number (0–10000) and end_number (1–10000) - the inclusive range to cycle through.
- label - a string that names this counter's state.
Outputs: number (the INT, which is the thing you actually wire somewhere) and now_number_text (a STRING like "现在输出的编号是:3" - the author writes in Chinese, so this human-readable label comes out in Chinese; it's cosmetic).
Gotchas worth knowing
The counter state is global to the pack, not per-workflow. Two different workflows that both use the label "Number 001" will fight over the same counter and advance each other's position - give every loop its own label. Resetting is also global-ish: there's no "reset" input, so to force a restart you either change the label or edit the JSON file. The text output is Chinese, which matters if you wanted a filename fragment out of now_number_text - use the number INT and format it yourself instead. And, standard for this pack's utility nodes: it was removed in the April 2025 repo rewrite along with the rest of the "Sanmi Simple Nodes," so fresh installs won't show it - the old Load_Image_Batch.py in git history is where it lives now.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/438443467/ComfyUI-GPT4V-Image-Captioner
Restart ComfyUI. No models, no extra downloads. If you just need "an integer that increments each run," this does it in one node - just don't share a label between two workflows and expect them to stay in sync.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| start_number | INT | 00–10000 | — |
| end_number | INT | 101–10000 | — |
| label | STRING | Number 001 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| number | INT | — |
| now_number_text | STRING | — |