ComfyUI Node

Split prompt

One text box, a batch of prompts, a whole deck of images

By lerignoux·Created about a year ago·Updated 10 months ago· 2
Split prompt
    • split prompt
    promptFirst Prompt Second Prompt
    split_on
    trimtrue

    The thing ComfyUI hides behind a list is its superpower: modern ComfyUI runs a node once per element of a list, which means one queue run can generate an image for every prompt you care to write. SplitPrompt is the cheap, cheerful front end for that. You type twenty prompt lines into one multiline box, it hands the graph a list of twenty prompts, and each line becomes its own generation - which is exactly what you want when the goal is a PechaKucha deck where every slide gets its own image.

    How it works

    There is no cleverness here, and that's the point. The node takes your prompt, calls prompt.split(split_on), and returns the result as a list (the node is declared OUTPUT_IS_LIST, so downstream nodes treat each element as a separate item). If trim is on, it strips whitespace off each line. The author openly credits ComfyUI-Inspire-Pack - ltdrdata's node pack - for the idea, and it's a good illustration of how much of the ecosystem is tiny utilities like this bolted onto ComfyUI's list machinery.

    The inputs that matter

    • prompt (multiline) - your prompt lines, one per slide you want.
    • split_on - the delimiter, defaulting to a newline. Change it to "," or "|" if your prompts arrive comma-separated instead.
    • trim (default true) - strips whitespace from each line before passing it on.

    Output: split prompt, a list of strings.

    Wiring it up

    The canonical graph is the example workflow that ships in the repo. SplitPrompt's output goes two places at once: into a CLIPTextEncode's text input (ComfyUI processes the list into a batched conditioning, and the KSampler expands the latent to match), and straight into GeneratePowerpoint's titles input. Result: N prompts → N images → N slides, each captioned by the prompt that made it. That single wire - the same list driving both generation and slide captions - is the whole trick, and it's the reason this utility exists rather than you retyping your prompts twice.

    Common issues

    • Trailing newline bites. The tooltip claims trim removes empty prompts, but the current code only strips whitespace - it doesn't filter empties out. "a\nb\n" splits into ["a", "b", ""], and that empty string becomes a real generation (usually a garbage image) and a blank slide in your deck. Delete the Enter at the end of your last line, or split on something that can't dangle.
    • Your lines have internal newlines. If a single prompt wraps across two lines, you'll get two prompts. Keep one concept per line, or switch split_on to a character you don't use in prose.
    • Downstream nodes that don't accept lists. The output is only useful if what you feed it speaks list. Modern core nodes (CLIPTextEncode, KSampler) do; some older custom nodes don't, and you'll get a type error - that's the node's fault, not this one's.

    How to install it

    Same story as the rest of the pack. Via ComfyUI Manager, search "PechaKucha" and install. By hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lerignoux/ComfyUI-PechaKucha
    cd ComfyUI-PechaKucha
    python -m pip install -r requirements.txt
    

    Restart ComfyUI. It's one tiny dependency (python-pptx) and no models. One note: this pack uses the newer comfy_api node API, so if the nodes don't appear at all after a restart, your ComfyUI is too old - update it first.

    Categorypecha_kucha

    Inputs (3)

    NameTypeDefaultDescription
    promptSTRINGFirst Prompt Second PromptA multiline prompt that will be split to batch generate.
    split_onSTRING Will split the input prompt on this character.
    trimBOOLEANtrueWill trim prompts and remove empty ones.

    Outputs (1)

    NameTypeDescription
    split promptSTRING