Nodes/ComfyUI — Compressed Metadata/📤 Extract Workflows to JSON
ComfyUI Node

📤 Extract Workflows to JSON

Back up every workflow in your output folder before it's too late

By jonstreeter·Created 11 months ago·Updated 11 months ago· 2
📤 Extract Workflows to JSON
    • STRING
    input_folder/tmp/ComfyUI/output
    output_folder/tmp/ComfyUI/output
    recursetrue
    use_image_nametrue
    append_suffix_workflow.json

    The backup you didn't know you needed

    You've been generating for months, and every output file quietly carries the workflow that made it - which is exactly how "workflow included" became the community norm. But those files will get re-encoded, stripped, or re-uploaded at some point, and EXIF is usually the first thing to go. ExtractWorkflowsToJSON is the insurance policy: point it at a folder and it walks every image, pulls out the embedded workflow, and writes it to a .json file. Now your workflows live on as plain text, independent of the images that carried them.

    How it works

    You give it an input folder and an output folder. It scans for .jpg, .jpeg, and .webp files, opens each one, reads the EXIF UserComment, and decompresses anything tagged COMPRESSED:. If there's no compressed tag, it falls back to the image's prompt text. Whatever it finds gets dumped to disk as JSON. When it's done it returns a status string - Processed 120 images: 118 workflows extracted to JSON, 0 errors. - so you know what happened at a glance.

    Note what it does not touch: PNG. Core ComfyUI PNGs store workflows in a text chunk rather than EXIF, and this node doesn't read that. For a standard PNG, just drag it into ComfyUI and export the workflow - or feed it through ConvertToCompressed first.

    Inputs that matter

    Five inputs, and you'll set most of them at some point:

    • input_folder / output_folder - where to scan and where to write. Both default to the output directory, so by default JSON lands next to your images.
    • recurse - walk subfolders or just the top level. On by default, which is what you want for a real output archive.
    • use_image_name - name the JSON after the image (image_001.pngimage_001_workflow.json). Off, and you get workflow_00001_workflow.json style names. Keep it on.
    • append_suffix - what gets appended to the name. The default _workflow.json is fine.

    The single STRING output is the status message. It's not an output node - nothing to wire downstream, it just does its job when you queue it.

    Install

    Same one-liner as every node in this pack:

    cd <ComfyUI>/custom_nodes
    git clone https://github.com/jonstreeter/comfyui-compressed-metadata
    pip install -r comfyui-compressed-metadata/requirements.txt
    

    Or ComfyUI Manager → search "Compressed Metadata", then restart. The only dependency beyond what ComfyUI ships is piexif; no models, nothing heavy.

    Gotchas

    • Only reads files that still have EXIF. An image that already had its metadata stripped is skipped silently - which is why you run this before uploading things, not after.
    • Corrupt payloads are skipped but counted. The status string reports the error count; the console has the per-file details.
    • JSON lands beside the images by default. Fine for a personal archive, mildly annoying in a shared directory. Set output_folder if you want them gathered up.
    • It's a per-image dump, not a merge. Every image with a workflow gets its own file. That's usually what you want - it keeps the provenance of each generation intact.

    If you've got a folder of JPEG/WebP output that came from this pack or from any EXIF-carrying source, run this once and stop worrying about the re-encode.

    Categoryutils

    Inputs (5)

    NameTypeDefaultDescription
    input_folderSTRING/tmp/ComfyUI/output
    output_folderSTRING/tmp/ComfyUI/output
    recurseBOOLEANtrue
    use_image_nameBOOLEANtrue
    append_suffixSTRING_workflow.json

    Outputs (1)

    NameTypeDescription
    STRINGSTRING