AD Image Selector
Rotate through 10 images — randomly, cyclically, or by index
- image1
- image2
- image3
- image4
- image5
- image6
- image7
- image8
- image9
- image10
- image
- selected_index
- info
AdvancedImageSelector is the "which of these images should I use this run" node. You feed it up to ten images and it hands back one, chosen by a mode you control: random (seeded), cycling forward, cycling backward, or a fixed index. It also reports which slot it picked and why, as outputs you can wire elsewhere. It's the natural fit for prompt-shuffling workflows, batch A/B testing, or any time you want a random-but-reproducible pick from a small pool.
How it works
Ten optional image inputs, and it builds the candidate list from whichever are actually connected - disconnected ports are skipped, so the pool size is dynamic. Then the mode decides:
- 随机 (random) - picks with
random.Random(seed), so the same seed gives the same pick. Reproducible randomness, which is rarer than it should be in ComfyUI. - 递增循环 (increment cycle) - steps forward through the pool on every run.
- 递减循环 (decrement cycle) - steps backward.
- 索引选择 (index select) - picks by the
indexinput; if that slot isn't connected, it falls back to the nearest connected index and says so in the info output.
Outputs are image, selected_index (the slot number), and info (a human-readable string saying what happened, e.g. 随机选择 - 索引:3, 种子:42). The random mode only re-executes when the seed changes - sensible - while the cycling modes re-execute every run by design.
The inputs that matter
- mode - the dropdown. Here's the quirk: the option labels are in Chinese (
随机,递增循环,递减循环,索引选择), which trips up English-only users on sight. Map: 随机 = random, 递增循环 = increment, 递减循环 = decrement, 索引选择 = index. - seed - matters only for random mode.
- index - matters only for index mode, 0–9.
- image1…image10 - the pool.
Where you'd actually use it
The classic pattern is a prompt/variation roulette: feed it a batch of reference images or previous generations, set random with a seed you can hand to other nodes, and let a single run pick for you - useful for seed-locked testing where you want the choice to change but the generation to stay deterministic. The cycling modes are for slideshow-style output: render one image per run, always a different one, and the node remembers where it is across runs.
Installing it
Part of ComfyUI-YCNodes. ComfyUI Manager → search ComfyUI-YCNodes → install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI-YCNodes
Restart. Torch and numpy only - no dependency risk.
Gotchas
The Chinese mode labels are the big one; if your ComfyUI is set to English the dropdown still shows the Chinese strings, and it's easy to click the wrong mode and think the node is broken. The index mode's "nearest fallback" is friendly but silent-ish - it does tell you in the info output, so wire info into a text preview if you want to see it. And remember the pool is built from connected inputs only: hooking up 3 images with index set to 7 won't error, it'll just pick the nearest of the 3. That's by design, but it's the kind of thing that reads as a bug at 2 a.m.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 随机 | 4 options: 随机, 递增循环, 递减循环, 索引选择 |
| seed | INT | 00–18446744073709550000 | — |
| index | INT | 00–9 | — |
| image1opt | IMAGE | — | |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| image5opt | IMAGE | — | |
| image6opt | IMAGE | — | |
| image7opt | IMAGE | — | |
| image8opt | IMAGE | — | |
| image9opt | IMAGE | — | |
| image10opt | IMAGE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| selected_index | INT | — |
| info | STRING | — |