ComfyUI Node

Background

Swap backgrounds like you're changing a costume

By itom0717·Created 6 months ago·Updated 6 months ago· 0
Background
    • text
    • id
    background
    background_custom

    Here's a workflow pattern that will save you more time than almost anything else in this pack: keep your character block locked, and let only the background change. The Background selector is the node you reach for when you're batch-generating the same character in a dozen scenes - cafe, beach, rainy street, classroom - without editing the prompt by hand each time.

    The whole Prompt String Selector pack is built around this "prompt as file collection" idea: every category (character, art style, pose, background…) lives in its own folder of text files, and a dropdown swaps between them. Background is one of the categories where that pays off immediately, because scenes are exactly the kind of thing you iterate on endlessly. With CLIP-encoded models (Illustrious, NoobAI, Pony, SDXL) a clean background tag block slots right into the tag-list structure the model expects.

    How it works

    The node watches ComfyUI/custom_nodes/ComfyUI-Prompt-String-Selector/data/background/. Drop a 02_cafe.txt in there, restart, and "02_cafe" shows up in the dropdown. The file's contents are what actually reaches your prompt; the filename is just the label, plus the leading number doubles as the id output.

    Ships with one file, 01_none.txt, which contains little more than a comma - a no-op block so you can wire the node in without changing anything. That's a nice touch: it means the "none" option is a real choice, not an empty socket you have to unplug.

    Inputs and outputs

    • background - the dropdown of your saved scene blocks.
    • background_custom - multiline override. Pick custom_input in the dropdown and this box's contents are used instead, with id output as 0.

    Outputs: text (STRING, comma-terminated) and id (INT). Wire text into the positive prompt path - typically by feeding it into the pack's Aggregator alongside your character and camera blocks. The comma termination is deliberate: the pack assumes you're concatenating blocks, so it adds the separator for you.

    Install

    ComfyUI Manager, search "Prompt String Selector", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/itom0717/ComfyUI-Prompt-String-Selector.git
    

    Restart after. Zero dependencies - no requirements.txt, no models to download. Pure Python standard library.

    Gotchas

    The dropdown only refreshes on ComfyUI restart. New background file, restart, new option. Annoying but harmless.

    One real tip: since location words like "beach" or "snow" can push some models toward blown-out highlights (a known issue on some Illustrious-family checkpoints), it's worth keeping your background blocks short and clean, and your negative selector ready with overexposed if a particular scene keeps overdoing it. The pack's own Negative selector makes that fix one dropdown click away rather than a prompt edit.

    CategoryPrompt String Selector

    Inputs (2)

    NameTypeDefaultDescription
    backgroundCOMBO2 options: 01_none, custom_input
    background_customSTRING

    Outputs (2)

    NameTypeDescription
    textSTRING
    idINT