Technical Architecture

Metadata Persistence

Prompt data embedded in image file structures survives naive deletion attempts. Understanding where metadata lives — PNG chunks, EXIF fields, XMP packets, JUMBF containers — reveals why compliance systems need architectural solutions, not manual cleanup.

February 25, 202610 minNumonic Team
Abstract visualization: Abstract virus-like cellular network illustration

When a creative team decides to strip metadata from an image before sharing it publicly, the typical approach is straightforward: open the file, delete the metadata fields, save. The image looks identical. The metadata appears gone. But “appears gone” and “is gone” are architecturally different statements — and the gap between them has real compliance consequences.

AI-generated images carry an unusual amount of embedded metadata. A single ComfyUI PNG can contain the complete workflow graph — every node, every connection, every parameter value — serialized as JSON inside the file's binary structure. Midjourney embeds generation parameters in EXIF description fields. Stable Diffusion writes prompt text, negative prompts, and sampler configurations directly into PNG text chunks. This metadata is valuable for reproducibility, but it also represents a compliance liability when images enter distribution channels.

The Forces at Work

Several forces create the metadata persistence problem:

  • Multiple container formats: Image files don't have “one place” where metadata lives. PNG files use text chunks (tEXt, iTXt, zTXt), EXIF segments, XMP packets, and ICC profiles — each stored independently in the binary structure. JPEG files add JFIF markers and IPTC-IIM segments. Newer formats like AVIF and HEIC add JUMBF containers for C2PA manifests. A single deletion tool rarely addresses all containers.
  • Tool-specific embedding choices: ComfyUI writes to PNG tEXt chunks with keys like “prompt” and “workflow.” Stable Diffusion A1111 writes to a “parameters” tEXt chunk. Midjourney writes to EXIF Description fields. Each tool has made independent decisions about where to store generation metadata, and no tool documents its choices in a machine-readable way.
  • Transcoding doesn't guarantee stripping: Converting from PNG to JPEG removes PNG-specific chunks — but EXIF data often survives the conversion. Converting to WebP may or may not preserve XMP packets depending on the encoding library. The assumption that “changing format removes metadata” is unreliable.
  • Partial deletion creates false confidence: A tool that strips EXIF data but leaves PNG tEXt chunks intact appears to have cleaned the file. The user believes the metadata is gone. A downstream consumer with a different extraction tool finds the prompt data still present. This is worse than no deletion at all — it creates a false sense of compliance.

The Problem

Prompt metadata embedded in image file structures survives naive deletion attempts because the metadata is distributed across multiple independent containers within the file format. No single “delete metadata” operation reliably addresses all containers, and different tools write to different containers without coordination. The result is that compliance workflows based on manual or ad-hoc metadata stripping are unreliable — and unreliable compliance is, practically speaking, non-compliance.

The problem is compounded by the metadata format divergence across generative tools. When every tool embeds metadata differently, every tool requires a different stripping strategy. A stripping workflow built for ComfyUI PNG chunks will miss Midjourney EXIF data entirely.

The Architectural Response: Metadata Persistence as a Design Constraint

Rather than treating metadata stripping as a simple file operation, treat it as an architectural concern with four requirements:

1. Enumerate All Containers

Before removing metadata, the system must know where metadata lives. This means parsing the file format to identify every container that could hold generation data:

The table reveals the challenge: a PNG file from ComfyUI could have generation data in tEXt chunks, EXIF fields (if re-exported through another tool), and XMP packets (if processed by Adobe software). Stripping one container while leaving others intact creates the partial deletion problem.

2. Format-Aware Stripping

Metadata removal must be format-aware — understanding which containers exist in a specific file instance, not just which containers are possible for the file type. A PNG that has been through Photoshop may contain XMP data that a PNG fresh from ComfyUI would not. The stripping logic must inspect the actual file, not assume based on the extension.

3. Verification After Stripping

After stripping metadata, the system must re-parse the output file to verify that no generation data remains. This is the step most manual workflows skip — and it's the step that catches partial deletion failures. Verification means running the same extraction logic that would be used to find metadata and confirming it returns empty.

4. Context-Dependent Stripping Profiles

Not all metadata should be stripped in all contexts. A legal archive should preserve everything — prompt data is evidence. A social media export should strip generation parameters but may need to preserve C2PA provenance manifests for regulatory compliance. A client delivery should strip workflow details but preserve color profiles and IPTC attribution. This is the privacy-tiered export pattern — different distribution contexts require different metadata profiles, defined as machine-executable rules rather than manual checklists.

Consequences

Benefits

  • Reliable compliance: When metadata stripping is systematic and verified, teams can confidently share images knowing that generation data has been removed according to the context-appropriate policy.
  • Reduced liability: Accidental prompt data leakage — where a client discovers your model choices, negative prompts, or workflow structure in a delivered image — is prevented by architectural guarantee, not manual diligence.
  • Audit trail: When the system records what was stripped and when, compliance becomes demonstrable. You can prove that image X was exported with policy Y on date Z, and that the output was verified clean.

Costs and Limitations

  • Processing overhead: Format-aware parsing and post-strip verification add computation time to every export. For bulk exports of hundreds of images, this cost compounds.
  • Format evolution: New container formats (JUMBF for C2PA, future AI metadata standards) require ongoing parser maintenance. The stripping system is only as complete as its format coverage.
  • Provenance trade-off: Stripping generation metadata can invalidate C2PA cryptographic signatures, creating a tension between privacy and provenance. The C2PA standard assumes metadata integrity — removing metadata breaks the chain of trust.

Related Patterns

  • The Two Metadata Problem — the format divergence that makes metadata persistence particularly challenging for AI-generated content.
  • Privacy-Tiered Export — the framework for defining context-dependent stripping policies as machine-executable rules.
  • Metadata Inversion — the shift from manual metadata creation to automatic metadata capture, which increases the volume of embedded metadata that persistence affects.
  • Cross-Tool Provenance — the problem of maintaining provenance across tool boundaries, which metadata stripping can interrupt.

See What Metadata Lives in Your Images

Use our free metadata inspector to discover the hidden data inside your AI-generated images — across every container format.

Try the Metadata Inspector