Nodes/ComfyUI-Prompt-Preset-Selector/Prompt Preset Selector (Image)
ComfyUI Node

Prompt Preset Selector (Image)

A prompt and its reference image, bundled in one YAML entry

By shin131002·Created 8 months ago·Updated 2 days ago· 2
Prompt Preset Selector (Image)
    • text
    • image
    • image_path
    • preset_list
    • selected_info
    preset_file
    absolute_path
    keyword
    keyword_modeOFF
    selection_modeManual
    preset_index0
    seed0
    enable_wildcardtrue
    image_index0

    Every ComfyUI preset node has the same blind spot: it hands you a prompt string, and that's it. But half the time a prompt isn't enough on its own - you want a character preset and the pose reference to run through ControlNet, or a style entry and the source image to feed an img2img pass. That's the gap this node fills: Prompt Preset Selector (Image) is the same preset-selector machinery as the rest of this pack, but each YAML entry can carry an image folder along with it, and the node outputs the matching image as a real IMAGE tensor.

    One honest caveat before anything else: the README doesn't mention this node at all. It documents four nodes and this is a fifth, registered in the code and discoverable in ComfyUI but effectively undocumented. What I'm about to describe comes from reading the source, so treat this page as the closest thing to docs it has.

    How it works

    You write your presets as YAML, and link images to keys with a [folder] suffix:

    heroes[hero_poses]:
      - superman, red cape, blue suit
      - batman, dark costume, mask
    

    When a line under that key is selected, the node looks in presets/images/hero_poses/ (inside this node's own directory), lists the .png/.jpg/.jpeg/.webp files there, and picks one by image_index. It loads it as an RGB tensor, ready to wire into anything that accepts an IMAGE input, and also hands you the absolute image_path as a string. The [folder] bit is stripped out of the key before the text output, so your prompt comes out clean - heroes: superman, red cape, blue suit, not heroes[hero_poses]: superman.... If a key has no image folder, or the folder is empty or missing, you get a 1x1 black image and "No image" as the path - silently, so check selected_info if your reference frame shows up black.

    The inputs and outputs

    Everything from the pack's Wildcard node is here - preset_file, absolute_path, keyword, keyword_mode, selection_mode (Manual / Sequential / Sequential (continue) / Random), preset_index, seed, enable_wildcard - plus one extra:

    • image_index - picks which image in the folder to use; it wraps around with modulo, so cranking it past the file count just loops back to the start.

    Outputs, and this is where it differs from its siblings:

    • text - the selected prompt (wire to CLIP Text Encode).
    • image - the IMAGE tensor, for img2img, ControlNet, or just a preview.
    • image_path - the absolute path of the image on disk, handy if you want to reference it elsewhere.
    • preset_list and selected_info - the usual reference and debug strings.

    It's filed under its own category, promptPresetSelector, rather than the pack's usual text - mildly annoying when you're hunting for it in the node menu, but you'll only need to find it once.

    Install

    Same pack, same routine:

    cd ComfyUI/custom_nodes
    git clone https://github.com/shin131002/ComfyUI-Prompt-Preset-Selector.git
    pip install pyyaml   # optional, for YAML files
    

    Then restart ComfyUI. The image loading leans on Pillow, numpy, and torch - all already present in any working ComfyUI install, so there's nothing extra to fetch.

    Where people get burned

    The black-image fallback is the big one: no folder, empty folder, or a typo in the [folder] name all produce a black 1x1 frame without raising an error, and the workflow happily continues. If you ever get a black reference image, read selected_info - it names the missing folder. Second, images have to live under presets/images/<folder>/ inside this node's directory; it won't go hunting through arbitrary absolute paths like the other inputs do. And given the "no individual support" disclaimer this pack ships with, an undocumented node like this one is the definition of use-at-your-own-risk - but for bundling prompt-plus-reference in one reusable YAML entry, it does something nothing else in the pack does.

    CategorypromptPresetSelector

    Inputs (9)

    NameTypeDefaultDescription
    preset_fileCOMBO1 options: (No preset files found)
    absolute_pathSTRING
    keywordSTRING
    keyword_modeCOMBOOFF3 options: OFF, AND, OR
    selection_modeCOMBOManual4 options: Manual, Sequential, Sequential (continue), Random
    preset_indexINT00–9999
    seedINT00–18446744073709550000
    enable_wildcardBOOLEANtrue
    image_indexINT00–9999

    Outputs (5)

    NameTypeDescription
    textSTRING
    imageIMAGE
    image_pathSTRING
    preset_listSTRING
    selected_infoSTRING