Nodes/Eden.art nodesuite/Prompt from Image Folder 🎲
ComfyUI Node Runs on cloud

Prompt from Image Folder 🎲

Your Old Renders Still Remember Their Prompts β€” This Node Reads Them Back

By edenartlabΒ·Created 3 years agoΒ·Updated about 22 hours agoΒ· 120
Prompt from Image Folder 🎲
    • prompt
    • negative_prompt
    • filepath
    • index
    • file_count
    β—„folderβ–Ί
    β—„seed0β–Ί
    β—„include_subfoldersfalseβ–Ί
    β—„extensions.pngβ–Ί
    β—„ordernameβ–Ί
    β—„name_filterβ–Ί
    β—„skip_files_without_prompttrueβ–Ί
    β—„fallback_promptβ–Ί

    If you've been generating for a while, your ComfyUI/output folder is a graveyard of prompts you were proud of and can no longer remember. Every one of those PNGs still has the prompt welded into it - that's the whole point of the metadata chunk - but getting it back usually means dragging images onto the canvas one at a time. Prompt from Image Folder 🎲 turns the folder itself into a prompt source: point it at a path and it hands back the positive prompt of some image in there, ready to wire into a text encoder.

    It's the node for reusing your own archive instead of writing something new: prompt roulette for seed hunting, recovering a phrase you know you had, or sampling your old renders as inputs to a variation workflow.

    How it works

    ComfyUI images carry two JSON chunks: workflow, the UI graph, and prompt, the API graph that actually ran (the KB's image-io-metadata doc). This node reads the second one, deliberately - the API graph has no Note nodes, no reroutes, no bypassed branches, because all of that is frontend-only and stripped before execution. The noise problem solves itself.

    From there it walks the graph: find the samplers and guiders, follow each one's positive conditioning upstream until it hits a text-encoder node (anything with a clip input), then resolve that encoder's text, chasing links through primitive and concat nodes. Node types are matched by input names, not class names - which is why it survives workflows built from random custom packs, as long as they stick to conventional positive/negative/clip naming. With nothing found, it falls back to the longest prompt-like string in the graph, then to A1111-style parameters text, so Forge and A1111 images read too.

    One consequence to expect: on a Flux graph the negative side is zeroed conditioning and the walker stops at ZeroOut, so negative_prompt comes back empty rather than wrong. Results are cached per file by mtime and size, so a fixed seed on an unchanged folder is served from cache and won't re-roll.

    The inputs that matter

    • folder - an absolute path string, and it does not default to ComfyUI's output directory. It's empty by default, ~ expands, and relative paths resolve against ComfyUI's working directory. Paste the real path.
    • seed - the picker. The chosen file is seed % file_count, so it's a stable index, not a random draw. Under it sits the familiar control_after_generate dropdown: randomize gives a different image every run, increment walks the folder one image at a time (the good mode for an overnight "try them all" batch), fixed repeats the pick. That dropdown's after-the-run default bites here exactly as it does on a KSampler seed (the KB's comfyui-node-plumbing doc): find a prompt you love in increment mode, and you've already stepped past it unless you set the widget control mode to Before.
    • order - name, date modified (oldest first) or newest first. The name sort is natural, so img2 lands before img10.
    • extensions - default .png; comma, space or semicolon separated lists work. WEBP and JPEG count too, because the reader checks ComfyUI's EXIF tags as well as PNG text chunks.
    • include_subfolders, plus three optional advanced fields: name_filter (substring, case-insensitive), skip_files_without_prompt (default on - keeps walking the list until it finds a readable prompt instead of erroring on the first bare file) and fallback_prompt (returned when nothing in the folder has one; leave it empty and you get an error instead).

    Outputs

    prompt goes into a CLIPTextEncode text field, or a string-replace node if you want to mutate the old prompt rather than reuse it verbatim. negative_prompt is the matching negative side. filepath, index and file_count are bookkeeping - index being the position in the sorted list, which is what you log by when you want to know which archive image a render came from.

    Installing it

    It ships in the Eden.art nodesuite - 80+ nodes that the studio says it uses in production. Search Eden Comfy Pack in ComfyUI Manager, or:

    comfy node install eden_comfy_pipelines
    

    or the manual route:

    cd ComfyUI/custom_nodes
    git clone https://github.com/edenartlab/eden_comfy_pipelines.git
    pip install -r eden_comfy_pipelines/requirements.txt
    

    Expect the pack's requirements.txt to be heavy - open_clip_torch, transformers, openai, scikit-learn, scipy, matplotlib, opencv-python, py7zr. That's a lot of wheel for a text node, and it's the price of the pack being all-or-nothing. ComfyUI 0.3.48+ and Python 3.10+ are required. This node itself is written in the newer comfy_api.latest authoring style, upstream's replacement for NODE_CLASS_MAPPINGS (the KB's comfyui-ecosystem doc).

    Where people get burned

    The folder has to actually contain ComfyUI output. Anything that re-encoded the file first - a Reddit or Discord upload, a screenshot, a JPEG export - has no prompt left to find. skip_files_without_prompt handles mixed folders gracefully. Empty results on a folder you can see files in usually means include_subfolders is off (the error message says so) or the extension list doesn't match what's in there.

    Boring prompts. The walker keeps the longest text on the encoder's positive side - right for regional prompting, but it means a prompt that came out of a pile of string concatenation can resolve into something uglier than what you typed. It's a best-effort reconstruction from a saved graph, not a telepathic read of your intent.

    No community corpus to fall back on. This pack barely appears in Reddit discussion - it's a studio's internal toolkit that got published, not a household name like Impact Pack. The upside is that nearly every input carries an accurate author-written tooltip, so read those instead of hunting for a tutorial.

    CategoryEden 🌱/Text

    Inputs (8)

    NameTypeDefaultDescription
    folderSTRINGFolder of ComfyUI-generated images.
    seedINT00–18446744073709550000Picks file number seed % file_count. randomize = random image each run, increment = next image each run, fixed = repeat.
    include_subfoldersBOOLEANfalseβ€”
    extensionsSTRING.pngComma-separated, e.g. '.png, .webp'.
    orderCOMBOnameFile order used by increment mode (and by the seed β†’ file mapping).
    name_filteroptSTRINGOnly use files whose name contains this text (case-insensitive).
    skip_files_without_promptoptBOOLEANtrueIf the picked file has no readable prompt, move on to the next file instead of raising an error.
    fallback_promptoptSTRINGReturned when no file in the folder has a prompt. Leave empty to raise an error instead.

    Outputs (5)

    NameTypeDescription
    promptSTRINGβ€”
    negative_promptSTRINGβ€”
    filepathSTRINGβ€”
    indexINTPosition of the picked file in the sorted list.
    file_countINTβ€”