Nodes/comfyui_region_uv_metadata/Read Comfy Prompt/Workflow From Image
ComfyUI Node

Read Comfy Prompt/Workflow From Image

Drag-and-drop won't restore the workflow? Read it out of the file instead

By csonxx·Created 5 months ago·Updated 5 months ago· 0
Read Comfy Prompt/Workflow From Image
    • prompt_json
    • workflow_json
    • has_prompt
    • has_workflow
    image

    Every PNG that comes out of ComfyUI carries its own source code. The node graph and the resolved API prompt are embedded as text chunks in the file, which is why you can drag a PNG back onto the canvas and get the whole pipeline reconstructed - the KB calls this "the workflow lives in the file," and it's the convention the entire sharing culture is built on. Read Comfy Prompt/Workflow From Image is for the moments that doesn't just work: when the file is a WebP, when the frontend fails to restore, or when you simply want to see what's actually in there.

    This node is part of the region-UV metadata pack, but it has nothing to do with regions. It's a general-purpose inspector: give it any PNG or WebP, and it reads the embedded ComfyUI prompt and workflow out of it. No models, no downloads, no detection - pure file parsing. It's the cheapest node in the pack and arguably the one with the broadest appeal.

    Why you'd need it

    The drag-image-back trick works because the full UI graph is stored as the workflow chunk. Two common situations break it:

    • WebP. WebP has no PNG text chunks, so the graph can only live in EXIF - and a lot of tooling never puts it there. Drag a WebP back and ComfyUI has nothing to rebuild from.
    • API-generated output. When ComfyUI runs as a backend (hosted generators, custom pipelines), only the API-format prompt gets written - no workflow - so the image drags back as a flat node-ID wiring, not the annotated graph the author built. It'll run, but it won't look like the original.

    This node reads both fields from PNG text chunks and from WebP EXIF, and hands you each as pretty-printed JSON, plus a boolean per field telling you which one actually survived.

    Inputs and outputs

    One input: image - a file picker, same as the Read Region node. Upload or select a PNG/WebP from your input folder.

    Four outputs:

    • prompt_json - the resolved API prompt (what the backend actually ran), as a JSON string.
    • workflow_json - the full UI graph (node positions, wires, widget values), as a JSON string.
    • has_prompt - boolean, whether a prompt chunk was found.
    • has_workflow - boolean, whether a workflow chunk was found.

    Those booleans are the honest truth-teller: an image can have a prompt but no workflow (API output), or neither (re-encoded or scrubbed). If both are false, no amount of staring at the pixels will reconstruct the graph - the metadata was text, and the text is gone. The recovery playbook lives in the KB's image-IO doc: get the original file from a host that didn't re-encode (CivitAI stores originals), or rebuild by hand from the visible settings.

    Install

    Same pack as the rest, so if you already installed comfyui_region_uv_metadata you have this node too. Via ComfyUI Manager (search "comfyui_region_uv_metadata"), or:

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

    restart, and it's under Image/Metadata as "Read Comfy Prompt/Workflow From Image." No heavy dependencies beyond the pack's standard set, and none of the model downloads.

    Troubleshooting

    • Both booleans false → the file was re-encoded or had metadata stripped. Nothing to recover; get the original.
    • has_prompt true, has_workflow false → you're looking at API-generated output. The JSON will run but won't restore a nice editable graph.
    • WebP shows nothing but the same image as PNG does → whatever tool wrote the WebP didn't put the payload in EXIF. This node only finds what's there.
    • You want to actually re-run the workflow → this node hands you JSON; if you need it loaded into the canvas, the frontend's normal drag-and-drop is still the tool when the workflow chunk survived.

    It's a quiet little node, but when someone posts a mystery image and asks "how was this made?", this is the one that answers.

    CategoryImage/Metadata

    Inputs (1)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png

    Outputs (4)

    NameTypeDescription
    prompt_jsonSTRING
    workflow_jsonSTRING
    has_promptBOOLEAN
    has_workflowBOOLEAN