ComfyUI Node

Set Metadata

Value pair you want onto a ComfyUI PNG

By romeobuilderotti·Created 3 years ago·Updated 2 years ago· 7
Set Metadata
      name
      value

      Set Metadata (All) covers the eight standard fields: prompt, seed, sampler, and the rest. Set Metadata is the escape hatch. It writes one arbitrary name: value pair into your PNG's metadata and - unless you're writing the parameters key itself - folds that pair into the A1111-style settings block at the same time. If you need a custom field the all-in-one node doesn't know about, this is the node you want.

      How it works

      Same machinery as its sibling, and it's worth understanding once because it explains a lot of weird ComfyUI behavior. Every run carries a shared PNG-info dict, and the built-in Save Image node writes every key in that dict to the file as a tEXt chunk. This node sets one key - extra_pnginfo[name] = value - then appends name: value to the parameters string, with two special cases: if name is prompt it replaces the first line, and if it's negative or negative prompt it sets the "Negative prompt:" line. Values containing commas, newlines, or quotes get wrapped in quotes so the A1111 format stays parseable.

      The inputs

      Two of them, and this is where beginners trip:

      • name - a plain text field. You type this one.
      • value - marked forceInput, so there's no text box; it's a connection socket. Drop a Text/String node on the canvas and wire it in, or feed it from whatever produces the string.

      No outputs. It's a write-only side-effect node; leave the socket empty.

      When you'd reach for it

      Any time you want a custom key that the big all-in-one node doesn't cover: a model hash, Lora names, a tag for your site, a score column, or a parameters block built entirely by hand for full control. One honest caveat: values land as strings. If you're feeding a tool that wants typed numerics - Diffusion Toolkit is the classic case - a numeric variant was proposed for this pack and never merged, so your number becomes "aesthetic_score": "5" and the tool may well ignore it.

      Install and gotchas

      Identical to Set Metadata (All) - same pack, shared install:

      cd ComfyUI/custom_nodes
      git clone https://github.com/romeobuilderotti/ComfyUI-PNG-Metadata
      

      then restart ComfyUI, done. No dependencies, no model downloads, MIT licensed. Or use ComfyUI Manager and search "ComfyUI-PNG-Metadata" - just make sure the author is romeobuilderotti and not the namesake reader pack by Kisaragi that does the opposite job.

      Two caveats apply unchanged from the pack's README. Execution order isn't enforced, so if this node runs after your Save Image node the metadata silently doesn't land; re-running usually fixes it since the order isn't stable. And the repo has been dormant since mid-2024 - it still works fine on current ComfyUI because it's pure Python with zero dependencies, but don't expect updates or bugfixes.

      It's a small, unglamorous utility. But when you need a specific field in your PNGs that nothing else writes, it's the one you'll keep coming back to.

      Categoryutils

      Inputs (2)

      NameTypeDefaultDescription
      nameSTRING
      valueSTRING

      Outputs (0)

      No outputs