Nodes/ComfyUI-Prompting-System/🧹 Metadata Cleaner
ComfyUI Node

🧹 Metadata Cleaner

Strip the recipe out of your PNG before you post it

By danieljanata·Created 8 months ago·Updated 8 months ago· 0
🧹 Metadata Cleaner
  • images
  • source_image
  • images
  • info
modeclean
filename_prefixcleaned_
savetrue
custom_metadata

Every PNG ComfyUI saves carries your entire workflow in its text chunks. That's the magic behind "workflow included" - drag the image back in and the whole graph rebuilds. It's also a leak: post an image and anyone who can drag it into ComfyUI gets your exact sampler settings, seed, and prompt for free. 🧹 Metadata Cleaner re-saves images with the metadata gone, or with only the metadata you explicitly choose. If you've ever uploaded a generation and thought "I don't actually want to hand out the recipe," this is the node.

How it works

You feed it an IMAGE tensor - straight from a VAE Decode, or from a Load Image output. It converts each frame to a PIL image and writes a fresh PNG into your output folder. The interesting part is what it writes into that PNG:

  • clean mode writes nothing. No prompt, no workflow, no parameters chunks - a genuinely bare PNG.
  • custom mode writes only your custom_metadata string as a parameters chunk, the A1111-style key, so other tools that read that key will find your text.
  • clone mode is listed, and here's the honest part: in the current code it saves the same stripped PNG as clean. The source_image input exists for the day "clone" learns to copy chunks from a reference file - don't rely on it yet.

The inputs that matter

images is the batch you're cleaning. mode is clean/custom/clone as above. filename_prefix defaults to cleaned_ and, usefully, accepts a subfolder: set Cleaner/IMG and it creates that folder under your output directory. save is the escape hatch - flip it off and the node just passes the images through without writing anything, handy when you want to keep metadata but leave the node in the graph. When you do save, the info output tells you how many files were written, and images passes your batch through untouched so the node can sit inline.

One detail that trips people up: filenames come out as cleaned_0000_0001.png - a per-batch index plus a collision counter. You'll never overwrite an existing file, but don't expect pretty names either.

Why you'd bother

The honest use case is not leaking your workflow, and a close second is handing someone a clean copy of a batch. It's also the pack's only image-saving node that doesn't assume you want a workflow embedded in the output - which, given how much of the community reflexively strips metadata before posting, is a real gap being filled.

Installing

Part of the ComfyUI-Prompting-System pack, so one install gets you this plus the pack's three other nodes and its "PS" sidebar tab. In ComfyUI Manager, search "ComfyUI-Prompting-System". Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/danieljanata/ComfyUI-Prompting-System

Restart ComfyUI and you're done. There's no requirements.txt and nothing to download - the pack leans on Pillow and numpy, which ComfyUI already ships. One caveat to keep in mind: this is a brand-new, one-person pack with no README in the repo, so verify behavior against the code if a future update changes modes. Today, clean and custom do what they say.

CategoryPrompting-System

Inputs (6)

NameTypeDefaultDescription
imagesIMAGE
modeCOMBOclean3 options: clean, custom, clone
filename_prefixSTRINGcleaned_
saveBOOLEANtrue
source_imageoptIMAGE
custom_metadataoptSTRING

Outputs (2)

NameTypeDescription
imagesIMAGE
infoSTRING