Prompt Looper Advanced
Loop through image+prompt lists without retyping anything
- image_prompt_list
- image_list
- index
- prompt
- image
- total_cnt
TKPromptLooper makes you type your scenes into the node. Prompt Looper Advanced is the version for when your scenes already exist - as a list of images with prompts, built by TKMultiImagePrompt, or as plain images from TKMultiImageSelect. Give it the list and an index, and it cycles through the entries, handing back the matching prompt and image, wrapped and counted. It's the consumer end of the pack's whole multi-image looping story: collector nodes build the list, this node plays it back one scene at a time.
How it works
Two optional inputs, one of which you'll wire: image_prompt_list (TK_IMAGE_PROMPT_LIST, from TKMultiImagePrompt) or image_list (TK_IMAGE_LIST, from TKMultiImageSelect). The only required input is index (an INT). On execution it sorts the list entries by their slot number so pairing stays deterministic, drops any entry missing its image or (for the prompt variant) a non-empty prompt, then does index % count and returns the selected pair - wrapping when the index runs past the end.
The image_prompt_list mode is the one most workflows want: you get both prompt and image out, matched. The image_list mode is for prompt-less workflows - you get an image and a null prompt. Feed it either, not both; if both are wired, the prompt list wins.
The inputs that matter
index- the loop driver, same as its sibling.image_prompt_listorimage_list- your content source. This is the whole reason to pick Advanced over the plain Looper.
Output
Four sockets: index (the wrapped index), prompt (selected prompt, or null in image-list mode), image (the selected frame), and total_cnt (how many valid entries the list actually held - genuinely useful for sizing loops and debugging "why did it stop early?").
Where it fits
Pair it with TKMultiImagePrompt and you get a workflow where editing your scenes means editing one widget instead of rewiring a graph: collect four (or eight, or twelve, chained) image+prompt scenes, loop through them with this node, and each iteration feeds a sampler the right pair. Because entries missing an image or a prompt are silently dropped, you can also use blank slots as a way to "turn off" scenes without deleting the wiring.
Common issues
The index-wrapping and zero-vs-one-indexed counter gotchas from TKPromptLooper apply identically here - start your counters at 0. The bigger one is feeding an empty or all-dropped list: the node raises a ValueError telling you no valid entries were supplied, rather than quietly failing, so the error message is the hint that your collector is upstream-unwired or every slot is blank. And note it drops entries with an image but empty prompt in list mode - if you want image-only scenes, use image_list instead of image_prompt_list.
Installing it
Part of trashkollector/TKNodes ("ComfyUI Handy Nodes"). Install via ComfyUI Manager (search "Handy Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/trashkollector/TKNodes
Restart, and it's under TKNodes. No dependencies.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| index | INT | 00–100 | — |
| image_prompt_listopt | TK_IMAGE_PROMPT_LIST | — | |
| image_listopt | TK_IMAGE_LIST | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| index | INT | — |
| prompt | STRING | — |
| image | IMAGE | — |
| total_cnt | INT | — |