Nodes/comfyui_region_uv_metadata/Save Metadata Image As PNG/WEBP
ComfyUI Node

Save Metadata Image As PNG/WEBP

The only save node that keeps your region metadata — and the webp default is the smart part

By csonxx·Created 5 months ago·Updated 5 months ago· 0
Save Metadata Image As PNG/WEBP
  • metadata_image
    filename_prefixComfyUI
    image_formatwebp
    webp_quality95
    webp_losslessfalse

    This is the output node for the region-UV pack, and it exists because of a format trap most people don't see coming. ComfyUI's built-in SaveImage writes its metadata into PNG text chunks - the tEXt/iTXt family, same place the workflow lives. That's fine for PNG. But WebP has no text chunks at all; the only place a flat JSON payload can live there is EXIF. So if you want a WebP that still carries your region outlines, the stock save node physically cannot do it. Save Metadata Image As PNG/WEBP is the pack's answer: it writes the region-UV payload to the right home for whichever format you pick, and it defaults to WebP - which, for the "store regions, share small" use case, is the format you actually want.

    How it works

    The node only accepts the REGION_UV_METADATA_IMAGE socket that comes out of Detect Region UV + Build Metadata Image - the custom type is the pack's way of guaranteeing the payload and the pixels travel together. When it saves:

    • PNG → metadata goes into PNG text chunks via PngInfo, alongside the standard ComfyUI prompt. Lossless, the round-trippable master (the KB is explicit: PNG is the only format that carries the full graph).
    • WebP → the payload is serialized into the EXIF ImageDescription / UserComment fields, because WebP has no text-chunk equivalent.

    The read node in this pack reads both, so the round trip is format-agnostic. One subtlety worth knowing: if ComfyUI was launched with metadata saving disabled (--disable-metadata or the "Disable saving prompt metadata in files" setting), the node quietly writes nothing - the file saves, the regions don't ride along. That's a deliberate respect-the-server-setting behavior, and it's the first thing to check if your saved files come back empty.

    The inputs

    • metadata_image - the only wire. Comes from the Detect node's metadata_image output.
    • filename_prefix (default ComfyUI) - same convention as core SaveImage: files land in ComfyUI/output/ with an auto-incrementing counter, and slashes make subfolders.
    • image_format - png or webp, default webp. This is the "if you want .png, switch it here" control.
    • webp_quality (default 95) - lossy quality. 95 is a genuinely good default: small file, no visible damage for this kind of output.
    • webp_lossless (off) - flip it if you need pixel-perfect WebP; files get bigger, which is why it's off by default.

    That's the whole list - no model weights, no config. It's a leaf node.

    Install

    Same pack as the Detect node, so if you already have comfyui_region_uv_metadata installed, you're done. Otherwise, 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 shows up under Image/Metadata. The requirements are the usual numpy / opencv-python / Pillow / torch / transformers>=4.57.1 set; the save node itself has no model downloads, so it's the cheapest node in the pack to get running.

    Troubleshooting

    • Saved file has no region metadata → check the ComfyUI metadata-disabled setting first; that's the #1 cause and it's invisible in the node itself.
    • Metadata vanishes after posting → not the node's fault. Any host that re-encodes (Reddit, most Discord previews, CDN thumbnails) strips text chunks and EXIF alike. Keep the original file as your master; the KB's image-IO doc covers the whole strip-vs-survive rule.
    • WebP file is huge → you left webp_lossless on; turn it off and drop quality toward 85-90 if size matters.
    • "Can't connect" the wiremetadata_image is a custom type; it only matches the Detect node's metadata_image output. A plain IMAGE won't plug in, and that's correct behavior.

    Practical workflow: Detect → this save node, default webp + 95 for sharing, switch to png when you want the archival copy. It's one of those quiet plumbing nodes you don't think about - until you try to read the regions back and they're there.

    CategoryImage/Metadata

    Inputs (5)

    NameTypeDefaultDescription
    metadata_imageREGION_UV_METADATA_IMAGE
    filename_prefixSTRINGComfyUI
    image_formatCOMBOwebp2 options: png, webp
    webp_qualityINT951–100
    webp_losslessBOOLEANfalse

    Outputs (0)

    No outputs