π§ͺ PerfectLab - Split
Pull one prompt out of a batch by number
- PROMPT
List outputs are great right up until you want one image. Ask the Prompt Assistant for 12 variations or let a Shot Series emit a whole session and ComfyUI will happily iterate all of it - which is the point, until you find the framing you want and now you want to re-render just that one at higher settings. π§ͺ PerfectLab - Split is the node that reaches into a stream of prompts and hands you a single line.
It's small enough to describe in a sentence and it solves a real annoyance: it turns "generate a batch" and "work on one of them" into two steps you can put in the same graph, instead of two graphs.
How it works
The node takes a string list and an index and returns the item at that index. It receives the whole list in one go rather than being run once per item, and its output is a single string - not a list. That's the entire mechanism, and the collapse is the feature: downstream of a Split, your graph runs once, not N times.
Two behaviours worth internalizing:
Negative indexes count from the end. -1 is the last prompt, -2 the one before it. Handy when you don't know the list length - "give me the last shot of the series" survives you changing count upstream.
Out of range returns an empty string. Silently. No red border, no error, no warning. The sampler gets an empty prompt and generates a perfectly nice image that ignores your subject, and you go looking for the bug everywhere except here.
Inputs and output
strings- the list. Wire a list output in here - a Prompt AssistantPROMPT, a Shot SeriesPROMPT, or anything else emitting strings.index- the item to pick, default0, accepting anything from-1000000to1000000.
One output, PROMPT, a plain string. Straight into a CLIP text encode, a preview text node, or another node's prompt input.
index is a widget by default, which means you can right-click it and Convert widget to input to drive it from a primitive or a counter if you ever want to sweep through a list that way. For the normal case, just type the number.
The usual workflow
Feed the same source into two branches. One path keeps the full list and generates the contact sheet; the Split branch sits downstream and re-renders the keeper. Set index to whatever position you liked, and keep the index fixed while you fiddle with the upscaler. Because the source list is deterministic from its seed, position 7 is always position 7 - which is why the Split is worth using instead of just rewriting the prompt by hand.
That's the honest pitch: it's a convenience node for when you don't want to copy a 90-word prompt out of a preview box.
Install
Part of the PerfectLab pack, alongside the Prompt Assistant and Concat. No Python dependencies - requirements.txt is intentionally empty and pyproject.toml declares none, so it adds nothing to your install.
cd ComfyUI/custom_nodes
git clone https://github.com/perfectmodelslab/ComfyUI-PerfectLab PerfectLab
Or ComfyUI Manager β Install via Git URL with the repo address. Restart ComfyUI, hard-refresh the browser (Ctrl+F5). Python 3.10+.
Where people get burned
Empty output, no error. The out-of-range case above is the whole bug report for this node. If your images suddenly have no prompt content, check the index against the actual list length first - especially after you changed count or variations upstream.
It collapses the batch, which is sometimes the surprise. Wire Split into a chain you thought was batched and you'll wonder why one image came out instead of twelve. That's correct behavior; the list stopped being a list.
The index is zero-based. Item 1 is index: 0. Everyone gets this wrong once.
Sketchy index values. There's a sanity limit on the widget but the underlying list is what matters. Ask for index 9 on a 5-item list and you get the empty string.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| strings | STRING | A string list, e.g. the PROMPT output of the main node. | |
| index | INT | 0-1000000β1000000 | Item index. Negative values count from the end; out-of-range yields an empty string. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| PROMPT | STRING | β |