Stable Diffusion and ComfyUI metadata: where prompts hide and how to clean them
By ExifZero Engineering · Updated
Short answer: Local image generators write reproduction data directly into PNG text chunks (or JPEG/WebP EXIF
UserComment) so you can drag an image back into the UI later. AUTOMATIC1111, Forge and SD.Next store prompts, seeds and model hashes in
a parameters chunk; ComfyUI embeds both prompt and workflow JSON graphs; NovelAI, InvokeAI and Fooocus
use their own JSON chunks. Keep your uncleaned PNGs in a private archive and batch-strip sharing copies losslessly.
Hosted AI services usually embed formal provenance claims (like OpenAI's C2PA manifest), whereas local open-weight interfaces embed engineering recipes. That design is great when you want to reproduce a render six months later, and awkward when you post a showcase image online without realizing it carries your local folder structure, private LoRA filenames, client project names or negative prompt lists.
Where each local tool writes its data
| Generator | Container location | What is exposed inside |
|---|---|---|
| AUTOMATIC1111 / Forge / SD.Next | PNG tEXt/iTXt key parameters; JPEG/WebP EXIF UserComment | Positive prompt, negative prompt, steps, sampler, schedule type, CFG scale, seed, resolution, model name, model hash, LoRA weights |
| ComfyUI | PNG tEXt keys prompt and workflow | Every node connection, CLIP prompt text, seed, custom node names, checkpoint/LoRA subpaths (e.g. clients/acme_v2.safetensors), UI notes |
| InvokeAI | PNG key invokeai_metadata (older builds: sd-metadata, Dream) | JSON object with prompt, model, scheduler, steps, CFG and ControlNet references |
| Fooocus | PNG keys parameters or fooocus_scheme | Prompt, negative prompt, style presets, performance mode, seed, base/refiner model |
| NovelAI | PNG keys Software, Source, Comment | JSON payload containing prompt, uc (undesired content), steps, sampler, scale and seed |
What the raw chunks look like
An AUTOMATIC1111 or Forge render looks deceptively simple when viewed as a picture, yet its parameters PNG chunk holds a plain-text
block structured like this:
editorial studio portrait of a ceramic teapot on linen, soft window light
Negative prompt: plastic, oversaturated, watermark, blurry
Steps: 28, Sampler: DPM++ 2M, Schedule type: Karras, CFG scale: 6.5, Seed: 418902114, Size: 1024x1024, Model hash: 6ce0161689, Model: juggernautXL_v9
ComfyUI goes much further. Its prompt chunk serializes the execution graph (where ExifZero extracts text from
CLIPTextEncode nodes), and its workflow chunk often weighs 15 KB to 120 KB of JSON detailing subfolder names and custom
nodes:
{
"3": {
"class_type": "KSampler",
"inputs": { "seed": 88412093, "steps": 24, "cfg": 5.5, "sampler_name": "euler" }
},
"4": {
"class_type": "CheckpointLoaderSimple",
"inputs": { "ckpt_name": "flux1-dev-fp8.safetensors" }
},
"6": {
"class_type": "CLIPTextEncode",
"inputs": { "text": "warm afternoon light across oak floorboards, 35mm film" }
}
} Notice that checkpoint and LoRA strings mirror your disk paths. If you keep project-specific LoRAs in folders named after clients or unreleased products, those directory names travel inside every ComfyUI PNG.
The two-folder workflow (recommended)
Turning off metadata saving permanently inside your UI is convenient until the day you want to tweak a seed or inspect which sampler produced your favorite render. A safer setup separates archival masters from publishable exports:
- Keep metadata ON in your working output folder. Let A1111, Forge or ComfyUI write full
parameters/workflowchunks to your local drive so you never lose a recipe. - Batch-clean only the export copies. Copy the finals into a sharing folder, drop the whole batch onto
ExifZero's metadata remover, and click Clean all & download ZIP. ExifZero removes every PNG text chunk and
EXIF comment while copying
IHDR,IDATand color chunks byte for byte — zero re-encoding. - Check the Summary and All metadata tabs on one output. Confirm no stray
Software,CommentorUserCommentfields survived, especially if you converted PNGs to WebP or JPEG earlier.
How to disable metadata saving in-app (when needed)
If you prefer never writing prompts at all, most local interfaces expose toggles — though exact menu labels vary by version and extensions:
- AUTOMATIC1111 / Forge: open Settings → Saving images/grids and untick Save text information about generation parameters as chunks to png files (and check any JPEG/WebP EXIF saving options underneath).
- ComfyUI: launch ComfyUI with the
--disable-metadataCLI flag, or use a save node that strips workflow metadata before writing to disk. - Fooocus: check the Advanced / Developer Debug Mode metadata toggle (depending on build, Fooocus can skip embedding
parameters/fooocus_scheme).
What happens when you convert PNG renders to WebP or JPEG
Many creators convert ComfyUI or A1111 PNGs to WebP or JPEG to save disk space before uploading to portfolios or client decks, assuming the
format switch discards PNG text chunks automatically. In practice, A1111, Forge and popular ComfyUI save nodes copy the generation string into
EXIF UserComment (0x9286) or XMP Description whenever you save as JPEG or WebP — and if an image contains
both EXIF and XMP, desktop converters like ImageMagick or XnConvert often carry those chunks straight across into the new format.
That is why checking the final export format in ExifZero's AI image checker is safer than relying on file
conversion alone. ExifZero parses PNG chunks, JPEG APP1 / COM segments and WebP EXIF / XMP
chunks uniformly, and its lossless cleaner cuts them out without adding a second round of JPEG or WebP compression loss.
One detail specific to PNGs exported from ComfyUI: if a file has both a large workflow chunk (say 80 KB of node coordinates) and a
prompt chunk, stripping those chunks reduces PNG file size immediately while keeping every RGBA pixel and transparency mask bit for
bit identical. If you publish sprite sheets, alpha-masked cutouts or high-detail renders, keeping pixels untouched avoids the color banding that
canvas re-savers often introduce.
Remember two boundaries: stripping PNG text chunks removes file metadata only (it never touches pixels or pixel-level watermarks), and if a site, contest or client requires disclosing AI-assisted artwork, removing generation chunks does not waive that disclosure rule.
Frequently asked questions
Does ComfyUI save my entire workflow graph inside every PNG?
By default, yes. ComfyUI writes two PNG text chunks into saved outputs: “prompt” (the API execution graph with your text prompts, seeds and checkpoint filenames) and “workflow” (the full UI node layout, custom node types and notes).
Does converting a Stable Diffusion PNG to JPEG remove the prompt?
Not automatically. Many WebUI extensions and image workflows copy the generation string into the JPEG EXIF UserComment field or XMP description. Always inspect the converted JPEG before assuming the prompt is gone.
If I strip metadata from my local PNG, can I still drag it back into ComfyUI or A1111 later?
No. Drag-and-drop workflow reloading relies entirely on those “prompt”, “workflow” and “parameters” PNG text chunks. Keep an uncleaned master folder locally for yourself and clean only copies meant for sharing.
Can ExifZero remove prompts from dozens of WebUI renders at once?
Yes. Drop a batch of PNG, JPEG or WebP renders onto the tool and click “Clean all & download ZIP”. All text chunks and EXIF comments are stripped losslessly in your browser without recompressing pixels.