Nodes/Comfyui_Needle2/Workflow From Image
ComfyUI Node

Workflow From Image

Read the workflow out of a PNG you didn't build

By DenRakEiw·Created a day ago·Updated a day ago· 1
Workflow From Image
    • json
    • source
    • found
    image
    chunkprompt

    ComfyUI has been quietly embedding your whole workflow inside every PNG it saves since forever. Drag a saved image back onto the canvas and the graph reconstructs; that's not a trick, it's the metadata doing its job. Workflow From Image is the same trick, but as a node: pick a PNG sitting in your input/ folder and it hands you the raw workflow JSON as a string you can then feed to the other workflow nodes in this pack. No engine, no model, no GPU - this is pure PNG chunk reading, and it's the front end for everything the "read a workflow back out" half of the pack does.

    The mechanism is the PNG spec, not magic. ComfyUI writes two text chunks into the file: prompt (the executed graph - node IDs, resolved values, the thing that actually ran) and workflow (the editor layout - node positions, wires, widgets, the editable thing). Both are just text riding in ancillary tEXt/iTXt chunks that any viewer ignores and any re-encode destroys. The KB's image-io-metadata essay has the full story, including the trap: a re-encoded host copy has nothing left to read.

    Inputs

    • image - a dropdown of every file in ComfyUI/input/, with upload support. Choose a ComfyUI PNG, not just any picture.
    • chunk - prompt or workflow. The tooltip says it plainly: prompt is the executed graph and the one worth parsing; workflow is the editor layout. When in doubt, use prompt.

    Outputs

    • json (STRING) - the raw chunk contents as text.
    • source (STRING) - which chunk it actually found (PNG text chunk: prompt, or the reason it failed).
    • found (BOOLEAN) - whether any ComfyUI metadata was present at all.

    If the file has no metadata, json comes back empty and found is false - and the source string tells you which chunks (if any) the file does carry. The node searches prompt, then workflow, so an API-generated image that only has the prompt chunk still works.

    What you do with the output

    The canonical wiring is Workflow From Image → Workflow Parse, which walks the graph into typed values (seed, steps, sampler, prompts...). When the graph is too weird for the parser's walk - custom prompt nodes, runtime-built strings - chain it into Workflow Texts instead, which lists every text node so you can pick. The three workflow nodes are designed as a ladder: pull the chunk, parse what you can, list what you can't.

    One honest caveat from the pack's own example files: example workflow 01_read_workflow_from_png.json preselects an image name that won't exist on your machine. Pick one of your own ComfyUI PNGs in the widget.

    Install

    Same pack as everything else: ComfyUI Manager (search ComfyUI Needle 2), or git clone https://github.com/DenRakEiw/Comfyui_Needle2 into custom_nodes/ and pip install cactus-needle, then restart. This node doesn't need the engine at all, so it works even on a machine where the model can't load. The practical limit is the same one that hits everyone: if the PNG was re-encoded, cropped, or saved with metadata disabled, the chunk is gone and no node can resurrect it from pixels.

    Categoryneedle/workflow

    Inputs (2)

    NameTypeDefaultDescription
    imageCOMBO1 options: example.png
    chunkCOMBOprompt`prompt` is the executed graph and the one worth parsing. `workflow` is the editor layout.

    Outputs (3)

    NameTypeDescription
    jsonSTRING
    sourceSTRING
    foundBOOLEAN