Nodes/ComfyUI_KimNodes/🍒Add_ImageMetadata / 合并保存图像元数据
ComfyUI Node

🍒Add_ImageMetadata / 合并保存图像元数据

Bake a metadata dict into any PNG, so it survives Photoshop

By wjl0313·Created 2 years ago·Updated 11 months ago· 54
🍒Add_ImageMetadata / 合并保存图像元数据
  • 输入被覆写图片
  • 输入图片元数据
    output_diroutput

    ComfyUI already embeds your workflow into every PNG it saves - that's how dragging an image back into the canvas reconstructs the graph. Add_ImageMetadata takes that idea one step further: it lets you write arbitrary key/value metadata into an image, from a dict input, and save it to a folder you choose. The author's own README spells out the three use cases, and they're worth reading: write workflow info into any image, embed promo or personal info for "more dissemination channels," and - the eyebrow-raiser - stamp metadata onto an image edited in Photoshop "to disguise them as original images."

    That third one is a bit sketchy, so let's be honest about it: the main legitimate use is the first. If you're building a pipeline that produces PNGs for an asset library and you want your own tags (creator, project, license, version) baked into the file header alongside the ComfyUI prompt data, this node does it cleanly.

    How it works

    You feed it three things: 输入被覆写图片 (the IMAGE to stamp), 输入图片元数据 (a DICT of key/value pairs), and output_dir (where to save, default output). It converts the tensor to a PIL image, walks every entry in the dict, and writes each as a PNG text chunk. The parameters key gets special handling (an iTXt chunk, which is what A1111-style tools read), everything else goes in as a plain tEXt chunk. It then saves with an auto-incrementing date-based filename like 20260816_1.png so you never overwrite.

    It's an output node - no outputs, it just writes the file. Note it takes a batch of images but only processes the first frame; if you feed it a batch you'll get one file.

    The inputs that matter

    • 输入被覆写图片 - the image tensor.
    • 输入图片元数据 - a DICT. You need a node that produces a dict; the pack's own metadata family (LoadImage_Metadata, Manual_MetadataInput) is the intended source, but anything outputting DICT works.
    • output_dir - destination folder. Relative to your ComfyUI working directory.

    Installation

    Standard KimNodes pack install (Manager → "ComfyUI_KimNodes", or clone into custom_nodes), then restart. Depends only on PIL, which ComfyUI already ships.

    Common issues

    • "Where did it save?" - output_dir defaults to output and resolves relative to ComfyUI's working directory, same as most custom save nodes. Use an absolute path if you want certainty.
    • Metadata key already exists - the node doesn't dedupe; if the dict contains a key the image already carries (like prompt from ComfyUI itself), you may end up with duplicate chunks. It's polite to exclude keys you don't want overwritten.
    • Nothing happens and the console is quiet - the node swallows most errors and returns early, so a bad dict or an unwritable path can fail silently. Check the terminal log for the printed traceback lines.

    And a note on the "disguise edited images" pitch: PNG metadata is trivially readable and just as trivially stripped. Nobody is fooling a forensics tool with a text chunk. Use this node for cataloging and provenance, not for anything you need to actually hide.

    Category🍒 Kim-Nodes/🔢Metadata | 元数据处理

    Inputs (3)

    NameTypeDefaultDescription
    输入被覆写图片IMAGE
    输入图片元数据DICT
    output_dirSTRINGoutput

    Outputs (0)

    No outputs