Nodes/comfyui-llm-prompt-studio/Load Image + Prompt (Civitai/A1111/ComfyUI)
ComfyUI Node

Load Image + Prompt (Civitai/A1111/ComfyUI)

Every old image still hides its prompt — this loader digs it out

By grandju51·Created 2 months ago·Updated 11 days ago· 5
Load Image + Prompt (Civitai/A1111/ComfyUI)
    • image
    • mask
    • positive
    • negative
    • raw_metadata
    image
    image_path
    strip_lora_tagstrue
    on_failureempty string

    Look at a PNG you generated six months ago and the image is all you see. But the file itself is still carrying the prompt, the negative, even the whole workflow - embedded as plain text in metadata your image viewer simply never shows you. ComfyUI's own LoadImage can't get at it: the moment a file is decoded into an IMAGE tensor, all that metadata is stripped. That's the gap this node fills. It's called Load Image + Prompt (Civitai/A1111/ComfyUI) and it opens the file itself, so you get the image and the prompt it was made with, in one shot.

    Reach for it whenever you want to regenerate or riff on something old. Seed an img2img pass from a previous result, recover the exact positive/negative when someone posts a great image without a workflow, or feed the recovered prompt straight into a CLIP Text Encode or an LLM prompt node. It's a drop-in replacement for LoadImage - same image dropdown, same upload button, and it even outputs mask, so you can swap it into an existing graph without rewiring anything.

    How it works

    The prompt is recovered by parsing embedded metadata, trying the most explicit source first:

    1. Civitai extraMetadata - a JSON blob with explicit prompt / negativePrompt fields, at the workflow root or under extra.
    2. A1111 / Civitai block - the PNG parameters chunk, or EXIF UserComment (UTF-16, the format A1111 writes).
    3. ComfyUI API graph - the PNG prompt chunk or JSON in EXIF.
    4. ComfyUI UI graph - the workflow chunk, best-effort.

    The ComfyUI cases are where the author earned their keep. Instead of grabbing "the first CLIPTextEncode" - which would frequently hand you the negative prompt - the node follows the sampler's positive link and walks through passthroughs (ControlNet, ConditioningCombine, primitives) to find the actual positive.

    Inputs that matter

    Three widgets, honestly:

    • image - the dropdown (with upload). Pick the file you want.
    • strip_lora_tags (on by default) - removes network tags like <lora:Train_Entrance_SDXL-000027:1>, <lyco:…>, <hypernet:…> from both outputs, and cleans up the orphaned commas so 1girl, <lora:x:1>, solo becomes 1girl, solo. Turn it off to get the prompt verbatim.
    • on_failure - what positive returns when no prompt is found: an empty string, or a short diagnostic message that tells you which source it tried. Keep this on "empty string" for pipelines, flip it to "error message" when you're debugging why a file came up blank.

    There's also image_path, an optional absolute path that overrides the dropdown - handy for reading files outside ComfyUI's input folder.

    Outputs

    image, mask, positive, negative, and raw_metadata (the raw metadata text, if you want to inspect what was actually in the file).

    Install

    Part of the comfyui-llm-prompt-studio pack - install the pack and you get this node plus three siblings. ComfyUI Manager: search comfyui-llm-prompt-studio. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/grandju51/comfyui-llm-prompt-studio
    

    Restart ComfyUI, refresh the browser. No pip install, no model downloads - the pack only uses the Python standard library, and PIL/torch already ship with ComfyUI.

    Common issues

    The author tested 4,654 local images and recovered prompts from 4,635 of them (99.6%). The remainder genuinely contain none - screenshots, and LoadImage → RemBg → SaveImage-style workflows with no sampler in them. So if you get an empty positive, the file probably never had a prompt, not the node failing. The on_failure diagnostic will tell you.

    One nice touch: the node re-reads the file when it changes on disk (mtime + size), so it plays nice with ComfyUI's caching instead of re-parsing on every run. And it tolerates workflows saved by older versions of the node with shifted widget values - it degrades to defaults rather than aborting the whole prompt with "Value not in list." The kind of robustness that only shows up after the author got bitten once.

    CategoryLLM Prompt Studio

    Inputs (4)

    NameTypeDefaultDescription
    imageCOMBOImage to load. Its embedded metadata is parsed to recover the prompt it was generated with.
    image_pathSTRINGOptional absolute path, overrides the dropdown. Use it to read an image outside ComfyUI's input folder.
    strip_lora_tagsBOOLEANtrueRemove LoRA/LyCORIS/hypernet tags from the outputs, e.g. <lora:Train_Entrance_SDXL:1>. The commas they leave behind are cleaned up too. Turn off to keep the prompt verbatim.
    on_failureCOMBOempty stringWhat 'positive' returns when no prompt is found: an empty string, or a short diagnostic message.

    Outputs (5)

    NameTypeDescription
    imageIMAGE
    maskMASK
    positiveSTRING
    negativeSTRING
    raw_metadataSTRING