Nodes/ComfyUI-Light-Tool/Light-Tool: Save Metadata
ComfyUI Node

Light-Tool: Save Metadata

Stuff your own data into a PNG's metadata and save it

By ihmily·Created 2 years ago·Updated 4 months ago· 20
Light-Tool: Save Metadata
  • image
    metadata

    ComfyUI's whole sharing culture runs on workflow metadata embedded in PNGs - "workflow included" is the norm, as the KB's ecosystem essay spells out. The built-in Save Image stamps the workflow/prompt automatically. This node is the version for when you want to embed your own data: you hand it an image plus a JSON string of metadata, and it writes the PNG to your output folder with that metadata baked into the file's tEXt chunks. Same mechanism ComfyUI uses, but you control the contents.

    What you set

    Two inputs: image (any IMAGE tensor) and metadata - a multiline JSON string. The format of that string decides how it's stored:

    • If the JSON contains prompt or workflow keys, each key is stored as its own metadata entry (values are stringified if needed).
    • Otherwise, the whole object is stored under a single workflow key as one JSON blob.

    Either way, a reader (the pack's Load Metadata From URL, or any PNG tEXt reader) can pull it back out. The file itself is saved to ComfyUI/output/ with a random UUID filename - so you get no control over the name, and you won't overwrite anything, which is the point.

    Why you'd use it

    Beyond the obvious "embed a caption or config with a render," it's the plumbing for data pipelines: tag an image with the parameters that produced it, add a human-readable label, or attach structured JSON that other tooling (gallery apps, scrapers, your own scripts) can read back. Because it doesn't depend on ComfyUI's own prompt state, it also works when your metadata comes from elsewhere in the graph - say a node that computed something worth remembering.

    Note the trade: the built-in Save Image is simpler and keeps the full workflow for drag-back reproducibility. Use this when you want your data, not the workflow, and you're okay losing the auto-stamped workflow (or you're providing it yourself via the workflow key).

    Installing it

    Part of ComfyUI-Light-Tool by Hmily. ComfyUI Manager → search "ComfyUI-Light-Tool" → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ihmily/ComfyUI-Light-Tool
    pip install -r requirements.txt
    # restart ComfyUI
    

    Uses Pillow's PNG info support - no models, offline.

    Where people get burned

    • Invalid JSON in the metadata field. It must parse as JSON or the node raises an error on execution. Build it with this pack's Serialize JSON Object to be safe.
    • Random UUID filenames. You can't set the name here. If you need named outputs, keep the built-in Save Image alongside.
    • It's an output node - nothing to wire onward. It saves and reports the image in the UI; there's no IMAGE out to continue the graph from.
    • Metadata is a niche. Most readers expect the standard prompt/workflow keys; custom keys are read by this pack's Load Metadata From URL and PNG-aware tools, not by every random viewer.

    If you've ever wished a render could carry its own provenance without relying on the standard workflow blob, this is the node.

    CategoryComfyUI-Light-Tool/image/ImageInfo

    Inputs (2)

    NameTypeDefaultDescription
    imageIMAGE
    metadataSTRING

    Outputs (0)

    No outputs