AI Generation & Prompts4 min readUpdated May 2026

How to Remove Stable Diffusion Prompts from PNG Files

Stable Diffusion and ComfyUI can embed prompts, seeds and workflow details in PNG text chunks. Learn how to inspect those fields and remove supported generation data from a copy.

Remove Embedded AI-Generation Details

Remove supported prompts, seeds and workflow metadata from compatible image copies. Visible image content and watermarks remain.

Key Takeaways

  • Some Automatic1111 and Forge workflows store generation parameters in PNG tEXt "parameters" chunks.
  • ComfyUI can store node graph and workflow data in PNG "workflow" and "prompt" chunks. The contents depend on the workflow and export settings.
  • Depending on the generator and file format, someone with the PNG may be able to inspect embedded prompt or workflow data using compatible tools. Not every image contains this information.
  • PurgeAI exports a rasterized copy through browser canvas. This usually does not preserve original PNG text chunks, but verify the output format and any metadata that matters to you.
Table of Contents6 sections

Why Stable Diffusion and ComfyUI Embed Your Prompts by Default

Some image-generation workflows store prompts or workflow data in supported PNG text chunks. Whether those fields are present depends on the tool, settings, export path, and file format.

If a PNG contains prompt or workflow metadata, someone with the file may be able to inspect those values in a compatible tool. Review the exported file before sharing a private workflow.

The Anatomy of PNG Chunks: tEXt, iTXt, and zTXt

The Portable Network Graphics (PNG) specification divides binary files into chunks. Core chunks include IHDR, IDAT, and IEND.

Ancillary chunks such as tEXt, iTXt, and zTXt can store textual information. Some applications use these fields to save generation parameters or workflow information, but not every PNG has prompt data.

Sample ComfyUI Workflow Chunk Leakage
{
  "extra_pnginfo": {
    "workflow": {
      "nodes": [
        { "type": "KSampler", "inputs": { "seed": 4829104928, "steps": 30 } },
        { "type": "LoraLoader", "inputs": { "lora_name": "custom_artist_style_v2.safetensors" } }
      ]
    }
  }
}

ComfyUI Workflow JSON Leaks in Image Headers

ComfyUI can store prompt and workflow data as JSON in PNG metadata chunks. If a workflow includes a local file path, that path may be visible in the original PNG metadata.

A workflow can expose a workstation username or local directory path when those details are included in its metadata.

Prevent Prompt Metadata in Stable Diffusion and ComfyUI Exports

In ComfyUI, the Save Image node can write prompt and workflow information into PNG metadata. The project’s command-line option --disable-metadata disables writing this metadata when launching ComfyUI. Use the option only when that trade-off fits your workflow, because the saved PNG will no longer carry the workflow record that can help reproduce a generation.

In AUTOMATIC1111, review Settings > Infotext and the “Write infotext to metadata of the generated image” option. Turn it off before generating files that should not carry prompt infotext. The exact setting name and availability can change across versions or forks, so confirm it in the installed build.

For an existing image, keep a copy of the original, create a clean export with a metadata-aware tool or a deliberate re-encode, then inspect the new PNG. Check tEXt, iTXt and zTXt fields rather than relying only on the filename or file size. ComfyUI’s metadata can include a complete workflow, not just the positive prompt, so inspect the complete output.

  • ComfyUI: use --disable-metadata at launch to prevent Save Image from writing prompt/workflow metadata.
  • AUTOMATIC1111: review Settings > Infotext > Write infotext to metadata of the generated image.
  • Existing PNG: preserve the source, clean or re-export a copy, and inspect the exported file’s PNG text chunks.
  • Before publishing: check that no prompt, workflow JSON or private local path remains in the output.

How re-encoding affects PNG prompt chunks

PurgeAI decodes the image in the browser and exports a new PNG from the canvas. The browser creates a new file rather than copying the original tEXt, iTXt, and zTXt chunks. Check the exported file with a metadata inspector when prompt removal matters.

The output may be smaller because text metadata and workflow chunks are not carried over, but the size change depends on the input image and export format. Verify the result with a metadata inspector.

Sources and further reading

For technical details, consult the original standards and documentation below. Platform behavior can change, so verify service-specific policies before relying on a result.

Frequently Asked Questions

Can I verify whether prompt metadata was removed?

Use a metadata inspection tool on the exported file. Canvas re-encoding usually omits the original prompt chunks, but check the specific format and output rather than relying on a universal guarantee.

Does this work on WebP and JPEG generations as well?

Some tools write prompt or workflow metadata to different containers, and export formats vary. PurgeAI re-encodes supported images, but verify the fields in your particular output.

Can I stop ComfyUI from writing the workflow into a PNG?

ComfyUI provides a --disable-metadata launch option that prevents the Save Image workflow from writing its prompt and workflow metadata. Confirm the option in the version you run and keep a separate workflow file if you need reproducibility.

PA

Written by PurgeAI Editorial Team

Editorial & Technical Team

The PurgeAI editorial team publishes in-depth blog articles about image metadata, file formats and file privacy. Sources are linked where available.

Advertisement