Extract Workflow From Image MXD
Never hand-copy a workflow JSON again
- image
- json_path
You know that dance where you export a workflow PNG, drag it into a text editor, and fish the "workflow": {...} blob out of the JSON metadata so you can share or diff it? This node kills that dance. Extract Workflow From Image MXD sits in your graph, grabs the workflow metadata from the current execution context, and writes it straight to a JSON file in ComfyUI/output/. Click run, grab the file, share it. That's the whole job, and it does it well.
Why it exists
Workflow JSON is the currency of the ComfyUI sharing scene - every workflow.json you download or upload is that blob. The trouble is pulling it out of an image's PNGInfo without a bunch of copy-paste. Maxed-Out-99 built this pack around his own free workflows (posted on Patreon, no signup), and this is one of the "make the boring parts of sharing easier" helpers that falls out of that habit.
How it works
The node never reads pixels. It's an output node wired into ComfyUI's execution context, which always carries two hidden fields: prompt (the current graph) and extra_pnginfo (the workflow definition ComfyUI bakes into saved images). Extract Workflow From Image MXD looks for a workflow key in extra_pnginfo, decodes it (it even strips a leading workflow: prefix and tries a few encodings), falls back to the prompt graph if needed, and dumps the result as indented JSON.
The image input is really just the trigger - the tooltip spells it out: "Any connected image. Used to trigger extraction/save." Wire any image output from the current run into it so the node executes after generation.
The inputs that matter
- image - a trigger. Connect the image your workflow just produced.
- filename_prefix - where the file lands. Default
workflow/ComfyUImeansComfyUI/output/workflow/ComfyUI_00001_.json. You can put subfolders here, soworkflow/my_runnests them.
The one output, json_path, is the relative path to the saved file inside output/ - handy if you want to feed it into another node that reads files back.
Install
It's part of the MaxedOut pack, so it installs with the rest:
cd ComfyUI/custom_nodes
git clone https://github.com/Maxed-Out-99/ComfyUI-MaxedOut.git
Then restart ComfyUI. Easier: ComfyUI Manager → search "Maxed Out" → Install → restart. No model files, no extra Python dependencies - this one's pure workflow plumbing.
Common gotchas
- "No workflow metadata is available in this execution context." This is the failure you'll actually see. It means whatever you connected to
imageisn't carrying metadata - usually because you wired in an image loaded from disk (via Load Image) instead of one generated in this run. Use an image from a node downstream of your generation. - The saved JSON is the graph, not your latest tweaks if you're editing live while an old image passes through. Rerun once after changes.
- Don't point
filename_prefixat a path outsideoutput/; the node is hard-wired to ComfyUI's output directory.
It's a small node, but once it's in your template workflow you'll wonder how you ever exported by hand.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Any connected image. Used to trigger extraction/save. | |
| filename_prefix | STRING | workflow/ComfyUI | Output JSON prefix. You can include subfolders, e.g. 'workflow/my_run'. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| json_path | STRING | Relative path to the saved JSON file in outputs. |