How to Remove Metadata from PNG Files
PNG is widely considered the "clean" image format. It uses lossless compression, supports transparency, and unlike JPEG, it was not designed with a built-in metadata standard like EXIF. But this perception is misleading. Modern PNG files can contain extensive metadata stored in multiple types of ancillary chunks -- and AI image generators are prolific writers. Midjourney, Stable Diffusion, ComfyUI, DALL-E, and Flux all embed identifying information in PNG files. If you share AI-generated PNG images without cleaning them, you are broadcasting exactly which tool you used, your generation parameters, and in some cases your account information. Here is how PNG metadata works and how to remove it completely.
PNG Chunk Architecture: How Metadata Hides in Plain Sight
A PNG file is composed of a sequence of chunks, each with a four-character type code, a length field, the data payload, and a CRC checksum. The PNG specification defines two categories of chunks: critical chunks (required for rendering the image) and ancillary chunks (optional, carrying supplementary information).
The critical chunks are:
- IHDR -- Image header (width, height, bit depth, color type, compression, filter, interlace)
- PLTE -- Color palette (for indexed-color images)
- IDAT -- Image data (the compressed pixel data, often split across multiple IDAT chunks)
- IEND -- Image end marker
Everything else is an ancillary chunk. And this is where metadata lives.
PNG Chunk Naming Convention
PNG chunk types use a four-character code where the case of each letter carries meaning. Lowercase first letter means the chunk is ancillary (not required for rendering). Uppercase first letter means it is critical. This naming convention helps software determine which chunks can be safely ignored or removed.
The Metadata-Carrying Chunks in PNG Files
AI image generators and image editing tools write metadata to several types of PNG ancillary chunks. Here is what each one stores:
tEXt chunks store uncompressed key-value text pairs. This is the most common metadata container in PNG files. AI tools use tEXt to embed generation parameters:
- Midjourney writes a tEXt chunk with the key
Descriptioncontaining the full generation prompt, and chunks with keys likeCreation TimeandSoftwareidentifying the tool. - Stable Diffusion (via Automatic1111 WebUI) writes a tEXt chunk with the key
parameterscontaining the positive prompt, negative prompt, sampling method, steps, CFG scale, seed, and model hash -- a complete recipe for reproducing the image. - ComfyUI writes a tEXt chunk with the key
workflowcontaining the full node graph as JSON, and another withpromptcontaining the workflow prompt. This can be several kilobytes of data. - Flux (via various frontends) writes generation parameters including the model version, guidance scale, and seed.
iTXt chunks are the internationalized version of tEXt. They support UTF-8 encoding, language tags, and translated keywords. Some tools use iTXt for the same purpose as tEXt but with extended character support. XMP data is frequently stored in an iTXt chunk with the keyword XML:com.adobe.xmp.
zTXt chunks are compressed tEXt chunks. The text payload is compressed with zlib (the same algorithm used for PNG image data). Some AI tools use zTXt when the metadata is large -- ComfyUI workflows, for example, can exceed 10 KB when stored as JSON, making compression worthwhile.
eXIf chunks were added to the PNG specification in 2017 (as an extension to the original spec) to store EXIF data in PNG files. Not all PNG files contain eXIf chunks, but cameras and some image processing tools do write them. When present, an eXIf chunk contains the same IFD (Image File Directory) structure used in JPEG EXIF data, including GPS coordinates, camera model, timestamps, and orientation.
caBX chunks store C2PA content credentials in PNG files. The caBX chunk contains a JUMBF (JPEG Universal Metadata Box Format) box structure with CBOR-encoded manifest data, cryptographic signatures, and provenance assertions. AI tools that support C2PA -- including Adobe Firefly and DALL-E -- embed their content credentials in caBX chunks.
| Chunk Type | Compression | What AI Tools Store Here | Typical Size |
|---|---|---|---|
| tEXt | None | Generation prompts, parameters, seeds, model hashes | 200 bytes – 15 KB |
| iTXt | None (UTF-8) | XMP packets, internationalized metadata, C2PA references | 500 bytes – 50 KB |
| zTXt | zlib | Compressed workflows (ComfyUI), large parameter blocks | 500 bytes – 10 KB |
| eXIf | None (binary) | Camera EXIF data, GPS coordinates, timestamps | 500 bytes – 5 KB |
| caBX | None (binary) | C2PA content credentials, cryptographic signatures | 50 KB – 320 KB |
What Your AI-Generated PNG Reveals
Let us look at the actual metadata that popular AI image generators embed in PNG files:
Midjourney PNG files typically contain 3 to 5 tEXt chunks. The Description field holds your complete prompt text -- every word you typed. The Software field identifies "Midjourney" along with the version. Additional fields may include the job ID, which can be traced back to your Midjourney account. Anyone who receives your PNG file can read these fields in seconds.
Stable Diffusion PNG files (generated via Automatic1111 or similar WebUI) contain a single large tEXt chunk with the key parameters. The value is a multi-line string that includes your positive prompt, negative prompt, sampling method (e.g., DPM++ 2M Karras), sampling steps, CFG scale, seed number, and the model hash. This is a complete reproduction recipe -- anyone with the same model can recreate your exact image.
ComfyUI PNG files are especially revealing. ComfyUI stores its entire node graph -- every node, every connection, every parameter -- as JSON in the workflow tEXt chunk. This can be 5 to 20 KB of data. The prompt chunk stores the executed workflow. Together, these chunks expose your entire creative process: which models you loaded, what LoRAs you applied, the exact values of every parameter, and the structure of your custom workflow.
Stable Diffusion Seeds Are Unique Identifiers
The seed number in a Stable Diffusion PNG is a 64-bit integer that uniquely identifies the exact noise pattern used to generate the image. Combined with the model hash, the seed allows anyone to reproduce your image exactly. More importantly, the seed ties the image to a specific generation session, which can be correlated with other images you generated in the same session.
Why Canvas Redrawing Is the Only Complete Removal Method
You might think you can remove PNG metadata by deleting specific chunks. In theory, this works: parse the PNG file, identify the tEXt, iTXt, zTXt, eXIf, and caBX chunks, remove them, and rewrite the file with the remaining chunks intact. Several tools attempt this approach.
In practice, binary chunk removal has three significant problems:
Problem 1: You must enumerate all metadata chunk types. PNG defines dozens of ancillary chunk types. Some are standardized (tEXt, iTXt, zTXt, eXIf, caBX, sRGB, gAMA, cHRM, iCCP), and some are proprietary (e.g., Photoshop writes sRGB and cICP chunks). You must know every possible metadata-carrying chunk type to remove them all. Miss one, and data survives.
Problem 2: Metadata can be hidden in unexpected places. Some tools embed metadata in chunks not traditionally associated with metadata. For example, the PNG specification allows private chunks with arbitrary type codes. A tool could write metadata in a chunk called xAI_ or mjBg and most metadata removers would not know to look for it.
Problem 3: Chunk reassembly can corrupt the file. Removing chunks from a PNG file requires recalculating CRC checksums and potentially reordering remaining chunks. Incorrect reassembly can produce files that render correctly in some viewers but fail in others.
Canvas redrawing avoids all three problems. When you draw PNG pixel data onto a Canvas and export it as a new PNG, the browser generates a fresh PNG file containing only the critical chunks: IHDR, IDAT, and IEND. No tEXt, no iTXt, no zTXt, no eXIf, no caBX, no private chunks of any kind. The output is a pure pixel image with zero metadata.
PNG Canvas Redrawing Is Lossless
Unlike JPEG, PNG uses lossless compression. This means canvas redrawing a PNG produces a pixel-perfect copy of the original image. Every pixel value is preserved exactly -- no quality loss, no compression artifacts, no visual difference. The only change is the absence of metadata. This makes PNG the ideal format for lossless metadata removal.
Removing PNG Metadata with RemoveAI Image
The process for removing metadata from PNG files using RemoveAI Image is straightforward:
-
Upload your PNG file by dragging it onto the drop zone or clicking to browse. You can upload up to 50 images at once.
-
Review the detected metadata. RemoveAI Image automatically parses all tEXt, iTXt, zTXt, eXIf, and caBX chunks and displays every metadata field it finds. You will see AI generation parameters, prompts, seeds, model hashes, C2PA credentials, and any other embedded data.
-
Click "Clean" to remove all metadata. The tool uses canvas redrawing to produce a fresh PNG with zero ancillary chunks. The process runs entirely in your browser -- no data is sent to any server.
-
Download the clean PNG. The output file is a standard PNG containing only IHDR, IDAT, and IEND. It is pixel-identical to the original but completely free of metadata.
FAQ
Do all PNG files contain metadata?
No. A minimal PNG file consists of only the critical chunks (IHDR, IDAT, IEND) and contains no metadata whatsoever. PNG files generated by basic screenshot tools or exported from certain applications may have no ancillary chunks. However, PNG files produced by AI image generators, image editing software, and digital cameras almost always contain metadata.
Can I remove only specific PNG chunks instead of all metadata?
Yes, using tools like ExifTool or custom scripts, you can selectively remove specific chunk types. For example, you could remove tEXt chunks (generation parameters) while preserving eXIf chunks (camera data). However, this requires technical knowledge and increases the risk of leaving identifying data behind. Complete removal via canvas redrawing is simpler and more reliable.
Does removing PNG metadata increase or decrease file size?
It can do either. Removing large metadata chunks (like ComfyUI workflows or C2PA manifests) reduces file size. But canvas redrawing produces a new PNG with its own compression, and the browser's PNG encoder may produce slightly different IDAT sizes than the original encoder. In most cases, the file size difference is negligible -- typically within 2 percent of the original.
PNG files may seem clean, but AI image generators pack them with identifying metadata -- generation prompts, seeds, model hashes, workflows, and C2PA credentials. RemoveAI Image strips every ancillary chunk from your PNG files using lossless canvas redrawing, all processed locally in your browser with zero uploads. Drop your PNG files, get clean images, and share with confidence.
Ready to clean your images?
Try our free browser-based tool to detect and remove AI metadata from your images.
Open Metadata Cleaner