PNG Metadata: How to View, Edit and Remove It Safely

November 08, 2026 · PNG.now Editorial · PNG Essentials

Understand which PNG metadata is useful, sensitive or required for correct rendering.

Metadata That Can Leak Sensitive Information

Textual chunks (tEXt, zTXt, iTXt)

These store key-value pairs. Common software writes values that include:

  • Software: name and version of the creating application (e.g., Adobe Photoshop 25.0)
  • Author, Title, Description: often filled automatically from OS user accounts or document properties
  • Comment: can contain internal notes, paths, or revision history
  • Source: some tools embed the source file path (e.g., /Users/john.smith/projects/confidential/report_v3.png)

Validation check: Extract all text chunks with pngcheck -7 file.png or pngtext file.png. Look for file paths, usernames, or project names.

Time chunk (tIME)

Stores the last modification timestamp. If you modify a PNG and re-save, the original creation time may persist in tIME unless explicitly cleared. This can reveal when a document was first created, not just last edited.

Color space chunks (gAMA, cHRM, sRGB, iCCP)

Rarely sensitive themselves, but iCCP can contain an embedded ICC profile. If you create a PNG from a custom color profile, the profile name or metadata within the ICC file may leak organizational information.

Critical Metadata You Should Not Remove

Removing certain chunks will break correct rendering. The PNG specification (Section 5, Chunk Ordering Rules) mandates that decoders must process these chunks to display the image:

Chunk Purpose Consequence if removed
IHDR Image header (width, height, bit depth, color type) Image cannot be decoded
IDAT Compressed image data Image is blank or missing
IEND Image trailer (empty marker) Decoder may reject file
PLTE Palette (indexed-color images only) Colors display as black or wrong
tRNS Transparency (if present) Loss of alpha/transparency

Hard limit: Never delete IHDR, IDAT, IEND, or PLTE. For tRNS, gAMA, cHRM, sRGB: only remove if you fully understand the color shift it will cause.

How to View All Metadata Including Hidden Chunks

Most image viewers show only a subset. These tools reveal the full chunk tree.

Command-line tools

# List all chunks with types and sizes
pngchunks file.png

# Extract text chunks to stdout
pngtext file.png

# Show all metadata in human-readable form
exiftool -a -G1 -s file.png

The -a flag in exiftool shows duplicate tags and unknown chunks. Without it, PNG metadata is often truncated.

GUI and manual inspection

  • TweakPNG (Windows): shows every chunk, allows editing and deletion.
  • ImageMagick identify -verbose: shows most common chunks but omits some ancillary ones.
  • Hex editor: PNG chunks are self-describing. Each chunk begins with a 4-byte length (big-endian), 4-byte type, then data, then 4-byte CRC. Scan manually for tEXt, zTXt, iTXt to find text data.

Editing Metadata Without Corrupting the File

Safe editing workflow

  1. Backup the original – one CRC failure can corrupt the entire file.
  2. Extract only the chunks you want to change – never rewrite the entire file with a generic tool that may strip critical chunks.
  3. Validate after editing – run pngcheck -v to confirm no chunk order violations or CRC errors.

Remove all text chunks using pngcrush

pngcrush -rem tEXt -rem zTXt -rem iTXt -rem tIME input.png output.png

This removes textual and time chunks while preserving color space and critical chunks.

Edit a specific text key with exiftool

exiftool -overwrite_original -Description="New description" file.png

Exiftool modifies only the targeted chunk and recalculates the CRC. It preserves unknown chunks.

Operations to avoid

  • Do not re-save in image editors (GIMP, Photoshop, Preview) – they often strip unknown chunks but may also reinterpret color data, recompress IDAT, or add new software tags.
  • Do not use convert from ImageMagick without -define png:preserve-colors – it will strip sRGB, gAMA, and cHRM by default, causing color shifts.

Complete Metadata Stripping for a Privacy-Cleaned PNG

For maximum privacy, produce a file that contains only:

IHDR → sRGB (or gAMA + cHRM if needed) → IDAT → IEND

This is the smallest valid PNG with correct color rendering.

Strip with pngcrush

pngcrush -rem alla -rem text -rem time -force file.png output_clean.png

-rem alla removes all ancillary chunks. -rem text and -rem time are redundant but explicit. -force overrides warnings about removing gAMA or sRGB.

Strip with exiftool for finer control

exiftool -all= -overwrite_original file.png

This removes all metadata except critical chunks. It preserves sRGB/gAMA/cHRM if present, which avoids color shifts.

Verification after stripping

pngchunks file_clean.png | grep -E '^[A-Z]{4}'

You should see only IHDR, sRGB (or gAMA/cHRM), IDAT, IEND. Any other chunk indicates incomplete removal.

Color Metadata: When to Keep or Strip

The PNG specification (Section 11.3, Colour Space Metadata) warns that stripping gAMA/cHRM/sRGB changes the interpretation of pixel values. If you remove these, a viewer will assume sRGB (per WCAG) or a default gamma of 1.0, which makes images appear too dark or too light.

Keep if: the image was created in a color-managed workflow and will be displayed in color-aware apps (browsers, design tools).

Strip safely if: the image is for web use only and was already in sRGB. In that case, the sRGB chunk is redundant but harmless. Stripping it reduces file size marginally.

Never strip sRGB/gAMA/cHRM from images with embedded ICC profiles (iCCP) unless you also remove the profile and convert to sRGB first. Otherwise, the image will display incorrectly in any color-managed viewer.

Final Verification Checklist

After editing or stripping metadata, confirm:

  • pngcheck -v file.png reports "OK" with no errors.
  • The image visually matches the original (open in two viewers side-by-side).
  • No unexpected chunks remain: pngchunks file.png | wc -l should be 4 (or 5 if sRGB is present).
  • File size changed only by the amount of removed chunk data, not by recompression.

Reference: https://www.w3.org/TR/png-3/