Image Cycler
Feed it a stack of reference images, it hands you one per run
- image_1
- image_2
- image_3
- image_4
- image_5
- image_6
- image_7
- image_8
- image_9
- image_10
- image
- current_index
Image Cycler is the workflow equivalent of a deck of cards that deals one card every time you hit Queue. Wire up to ten images, and each run it hands the next one downstream - then wraps back around to the first. That's the whole job, and honestly that's what makes it useful.
You reach for this whenever you want to run the same graph over a pile of images without touching the graph between runs. Classic case: you've got ten character reference shots and you want to see what your IPAdapter/PuLID/InstantID stack does with each one. Wire the cycler's output into the reference-image input, queue ten times, and every output is automatically a different subject - no drag-and-drop, no risk of running the same image twice by accident. It also shines for style-transfer-over-a-folder, batch inpainting, or any "run this same pipeline on every file in a set" chore where ComfyUI's native batch handling fights you. If you've never needed this, you will eventually, and the name is a lie in the best way: it calls no API, needs no key, and has zero dependencies.
How it actually works
The mechanism is dead simple, but there's one sneaky detail that makes it work at all. The node keeps a counter in a counter.json file stored inside its own folder under custom_nodes - not in memory, on disk. Each execution it loads that counter, picks the image at that index (wrapping with index % len(images) so it never runs off the end), returns it, and saves index + 1 back.
Here's the sneaky part: ComfyUI skips re-running nodes whose inputs haven't changed - and this node's inputs never change. The author gets around that caching by having IS_CHANGED return float("NaN"), which tells ComfyUI "always execute me, every single queue." No NaN, no advancing counter, no node. That's the whole trick, and it's why the cycle actually progresses instead of freezing on image one.
Because the counter lives in a file, the cycle survives a ComfyUI restart. That's usually what you want for a long batch; just remember it if you come back days later and it's "not starting over."
The inputs that matter
Only image_1 is required; image_2 through image_10 are all optional, so a two-image or six-image cycle is just as valid as a full ten. reset is a boolean widget - set it true and the node jumps back to image one. The two outputs are image (the IMAGE tensor for this run, wired into whatever consumes it) and current_index (a zero-based INT you can use to name files or drive a label).
Installing it
Two ways, both trivial. In ComfyUI Manager, search "Image Cycler" and hit install. Or do it by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/SteveCastle/comfyui-image-cycler.git
Then restart ComfyUI. There's no requirements.txt, no model download, nothing to configure - it's pure Python standard library. In an ecosystem where most nodes drag in a dependency tree that can break your whole install (see the ComfyUI ecosystem's dependency-hell history), a zero-dependency node is a small gift.
Where people get burned
- Multiple cyclers fight over one file. The counter is a single
counter.jsonshared by every ImageCycler instance in your install. Put two in one workflow and they'll clobber each other's counters. One cycler per workflow. resetlooks like a stuck node. When it's true, every run returns image one - by design. Flip it back off when you want the cycle to advance again, or you'll spend ten minutes convinced it's broken.- Changing the image count mid-cycle shifts the sequence. The counter just does modulo over however many images are connected, so removing one from the middle changes what comes next. Reset after editing the stack.
- Mixed-size images are fine - the cycler emits one image per run, not a batch, so differing resolutions won't throw a tensor-shape error downstream. It picks one and hands it over.
It's a five-minute fix for a genuinely annoying workflow problem, and it's the cheapest "batch your references" solution you'll find in the Manager catalog.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image_1 | IMAGE | — | |
| image_2opt | IMAGE | — | |
| image_3opt | IMAGE | — | |
| image_4opt | IMAGE | — | |
| image_5opt | IMAGE | — | |
| image_6opt | IMAGE | — | |
| image_7opt | IMAGE | — | |
| image_8opt | IMAGE | — | |
| image_9opt | IMAGE | — | |
| image_10opt | IMAGE | — | |
| resetopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| current_index | INT | — |