How to Extract Metadata from PNG Files
PNG files store metadata in discrete chunks rather than the APP markers used by JPEG. This guide explains the five main PNG metadata chunk types, walks through extraction with ExifTool, Python, and online tools, and shows how to automate metadata extraction for large image collections.
How PNG Stores Metadata Differently from JPEG
PNG and JPEG handle metadata in fundamentally different ways. JPEG embeds metadata in APP markers, specifically APP1 for EXIF data and APP13 for IPTC records. These markers sit between the Start of Image marker and the image data, each with a fixed structure defined by the EXIF and IPTC specifications.
PNG takes a different approach entirely. The format stores all data, including metadata, in typed chunks. Each chunk has a four-character type code, a length field, the data payload, and a CRC32 checksum for integrity verification. Metadata lives in ancillary chunks, meaning a PNG decoder can skip them without breaking the image display.
This chunk-based architecture gives PNG several useful properties:
- Extensibility. New chunk types can be added without breaking existing readers. The eXIf chunk for EXIF data was added decades after the original PNG specification.
- Integrity checking. Every chunk includes a CRC32 checksum, so corrupted metadata is detectable at the chunk level rather than silently returning bad data.
- Clean separation. Critical chunks (image data, header) are distinct from ancillary chunks (metadata), making it straightforward to strip metadata without touching the image.
- Flexible ordering. Ancillary chunks can appear anywhere between the IHDR header and the IEND terminator, except within IDAT image data sequences.
The practical consequence: tools built for JPEG metadata don't always handle PNG well. A basic EXIF reader designed around APP1 markers won't find PNG text chunks. You need tools that understand PNG's chunk structure to get the full picture.
PNG Metadata Chunks to Check
PNG metadata is stored in ancillary chunks. Five chunk types handle the bulk of metadata you'll encounter in real-world PNG files.
tEXt: Plain Text Key-Value Pairs
The simplest metadata chunk. It stores a keyword (1 to 79 bytes, Latin-1 encoded) followed by a null separator and an uncompressed text value. Common keywords include Title, Author, Description, Copyright, Creation Time, and Software. The text value also uses Latin-1 encoding. ExifTool writes new text metadata to tEXt chunks by default.
zTXt: Compressed Text
Functionally identical to tEXt, but the text value is compressed with zlib deflate. The keyword stays uncompressed so readers can identify the chunk without decompressing it first. Use zTXt when text values are long (embedded XML, lengthy descriptions) and file size matters.
iTXt: International Text
The Unicode-capable text chunk. It stores text in UTF-8 rather than Latin-1, and includes fields for a language tag and a translated keyword. iTXt also supports optional compression. This chunk is where XMP metadata lives in PNG files. PNG has supported XMP via iTXt chunks since the PNG 1.2 specification.
eXIf: EXIF Data
The eXIf chunk stores EXIF metadata in the same binary format used by JPEG's APP1 marker, minus the APP1 wrapper and Exif ID code. It contains camera settings, GPS coordinates, timestamps, and other standard EXIF fields. The eXIf chunk was proposed in early 2017 and formally included in the PNG Extensions specification (version 1.5.0) that same year. The W3C published the third edition of the PNG specification with full eXIf support as a Recommendation in June 2025. Despite standardization, adoption remains inconsistent. Many image editors still embed EXIF data in iTXt or tEXt chunks rather than using the dedicated eXIf chunk.
iCCP: ICC Color Profile
Embeds an ICC color profile for accurate color reproduction across displays and print devices. The profile data is compressed with zlib, and the chunk includes a profile name field for identification. When an iCCP chunk is present, the image samples conform to the color space defined by that embedded profile. This chunk matters for photography, print production, and any workflow where color accuracy is critical.
Extract PNG Metadata with ExifTool
ExifTool is the most comprehensive command-line tool for reading PNG metadata. It handles all five chunk types and can read, write, and delete metadata across hundreds of file formats.
Read All Metadata
To dump every metadata field from a PNG file:
exiftool image.png
This prints all metadata ExifTool can parse, including tEXt chunks, EXIF data, ICC profile information, and XMP properties. The output groups fields by their source type.
Target Specific Chunks
To read only PNG text chunks:
exiftool -PNG:all image.png
To extract the ICC profile to a separate file:
exiftool -ICC_Profile -b image.png > profile.icc
To read XMP metadata specifically:
exiftool -XMP:all image.png
Batch Processing
ExifTool handles directories natively. To extract metadata from every PNG in a folder and write results to text files:
exiftool -w txt -ext png /path/to/folder/
The -w txt flag writes output to sidecar files with matching names. The -ext png flag limits processing to PNG files only.
Write and Remove Metadata
To add a comment to a PNG file:
exiftool -Comment="Project alpha, version 3" image.png
ExifTool writes this as a tEXt chunk by default. To compress the text value, add the -z flag, which creates a zTXt chunk instead.
To strip all metadata while preserving the image:
exiftool -all= image.png
This removes XMP, EXIF, ICC profiles, and text chunks. ExifTool keeps a backup of the original file with a _original suffix unless you pass -overwrite_original.
One detail worth knowing: ExifTool positions text chunks before the IDAT image data during writes. Some Adobe and Apple tools won't read text chunks that appear after IDAT, so this ordering prevents compatibility issues.
Extract Metadata from Your Image Library Automatically
Fast.io Metadata Views let you describe the fields you need in plain language and extract structured data from PNG files, PDFs, and documents. Start with 50 GB free, no credit card required.
Read PNG Metadata with Python
Python offers several libraries for PNG metadata extraction, each suited to different needs.
Pillow: Quick Access to PNG Text Chunks
Pillow reads PNG text chunks through the image's info dictionary and text attribute:
from PIL import Image
img = Image.open("image.png")
# PNG text chunks appear in img.info
for key, value in img.info.items():
print(f"{key}: {value}")
# Text chunks specifically
if hasattr(img, "text"):
for key, value in img.text.items():
print(f"{key}: {value}")
Pillow handles tEXt, zTXt, and iTXt chunks automatically. It decompresses zTXt values and decodes iTXt as UTF-8. However, Pillow won't parse eXIf chunks or ICC profiles into structured fields on its own.
ExifRead: EXIF-Focused Extraction
ExifRead is a pure Python library with no external dependencies. It supports PNG files alongside JPEG, TIFF, WebP, and HEIC:
import exifread
with open("image.png", "rb") as f:
tags = exifread.process_file(f)
for tag, value in tags.items():
print(f"{tag}: {value}")
ExifRead works well for camera metadata like shutter speed, aperture, and GPS coordinates. It won't cover PNG-specific text chunks, so pair it with Pillow if you need both EXIF and text data.
PyExifTool: Full ExifTool Power from Python
PyExifTool wraps the ExifTool command-line application, giving you access to its complete metadata parsing:
import exiftool
files = ["image1.png", "image2.png", "image3.png"]
with exiftool.ExifToolHelper() as et:
metadata = et.get_metadata(files)
for item in metadata:
for key, value in item.items():
print(f"{key}: {value}")
PyExifTool requires ExifTool to be installed on the system, but it reads every metadata type PNG supports, including ICC profiles and XMP. Batch processing is faster than calling ExifTool separately for each file because PyExifTool keeps a single ExifTool process running across calls.
Choosing the Right Library
Use Pillow when you only need PNG text chunks and are already doing image processing. Use ExifRead for EXIF-focused workflows where you want a lightweight, dependency-free solution. Use PyExifTool when you need the most complete metadata extraction and can install ExifTool on the system.
Online PNG Metadata Viewers
When you need to inspect a PNG file quickly without installing anything, online metadata viewers handle the job. These tools parse the PNG chunk structure in the browser, so your image data typically stays local.
MetadataView reads EXIF, XMP, and all three text chunk types from PNG files. It displays results grouped by metadata standard and includes a separate tool for stripping metadata before sharing.
OptimizePNG provides a PNG metadata viewer that shows chunk-level data alongside EXIF and XMP fields. It's useful when you want to see the raw chunk structure rather than just the parsed metadata values.
dcode.fr PNG Chunks reads and displays individual PNG chunks including tEXt, zTXt, and iTXt data. It shows the raw chunk types and their contents, which helps when you need to debug chunk ordering or identify non-standard chunks.
Nayuki PNG Chunk Inspector breaks down every chunk in a PNG file with the type code, data length, and CRC checksum for each. This is more of a forensic tool than a metadata reader, but it's useful when you need to understand the exact binary structure of a file.
Online viewers work well for spot checks and one-off inspections. For anything recurring, like processing uploads or auditing image libraries, a programmatic approach will save time.
Automate PNG Metadata Extraction at Scale
Extracting metadata from a handful of PNG files is straightforward with any of the tools above. Doing it across thousands of images in a production workflow requires a different approach.
Build a Processing Pipeline
For self-hosted automation, combine ExifTool with a scripting layer. A common pattern is to watch a directory for new uploads, run ExifTool against each file, and write the results to a database or search index:
exiftool -json -r /uploads/png/ > metadata.json
The -json flag outputs structured JSON that's easy to parse downstream. The -r flag recurses into subdirectories. You can feed this into a script that inserts records into PostgreSQL, Elasticsearch, or any other data store.
For cloud-hosted workflows, AWS Lambda triggered by S3 upload events can run ExifTool in a container, and Google Cloud Functions offers the same pattern with Cloud Storage triggers. Both approaches scale horizontally but require you to maintain the extraction logic and infrastructure.
AI-Powered Extraction
Fast.io's Metadata Views take a different approach. Instead of writing extraction rules or configuring parsing logic, you describe the fields you want in natural language. The AI designs a typed schema and extracts matching data from every file in a workspace, including PNG images. You can extract fields like color profile type, creation software, embedded descriptions, or custom properties stored in PNG text chunks.
Metadata Views work alongside Fast.io's workspace layer. Upload PNGs to a workspace, define the fields you care about, and the extraction results appear in a sortable, filterable spreadsheet. Adding new columns doesn't require reprocessing existing files. Agents can also trigger extraction and query results through the Fast.io MCP server, which opens the door to fully automated metadata pipelines where files arrive, get analyzed, and route to the right workflow based on their properties.
For teams getting started, the free Fast.io plan includes 50 GB of storage and 5,000 monthly credits with no credit card required.
Frequently Asked Questions
Do PNG files have EXIF data?
PNG files can contain EXIF data, but support is more recent and less consistent than in JPEG. The eXIf chunk was proposed in 2017 and formally standardized in the PNG Extensions specification. The W3C published the third edition of the PNG specification with full eXIf support in June 2025. In practice, some image editors store EXIF data in the dedicated eXIf chunk, while others embed it within iTXt or tEXt chunks. ExifTool reads EXIF from PNG files regardless of which storage method was used.
How do I read metadata from a PNG file?
The fast method is ExifTool on the command line: run 'exiftool image.png' to see all metadata fields. For Python scripts, Pillow reads PNG text chunks through the image's info dictionary, while ExifRead handles EXIF-specific fields. Online viewers like MetadataView and OptimizePNG work for quick inspections without installing any software.
What metadata does PNG support?
PNG supports several metadata types through its chunk system: tEXt for plain-text key-value pairs like Title and Author, zTXt for compressed text, iTXt for UTF-8 international text and XMP data, eXIf for standard EXIF camera and GPS data, and iCCP for embedded ICC color profiles. PNG text chunks accept arbitrary keywords, so applications can embed custom metadata fields beyond the standard set.
How is PNG metadata different from JPEG metadata?
JPEG stores metadata in APP markers (APP1 for EXIF, APP13 for IPTC) with fixed structures. PNG uses typed chunks, each with a four-character code, data payload, and CRC32 checksum. This gives PNG better extensibility and integrity checking, but it also means that tools designed for JPEG metadata won't necessarily read PNG metadata correctly. The chunk-based approach makes it cleaner to strip metadata from PNG files, since you can remove ancillary chunks without touching the image data.
Can I remove metadata from PNG files before sharing?
Yes. ExifTool strips all metadata with the command 'exiftool -all= image.png', removing text chunks, EXIF, XMP, and ICC profiles while keeping the image intact. Online tools like MetadataView also offer PNG metadata removal. If you need to preserve the ICC profile for color accuracy but remove identifying information, ExifTool lets you selectively delete specific chunk types while keeping others.
Related Resources
Extract Metadata from Your Image Library Automatically
Fast.io Metadata Views let you describe the fields you need in plain language and extract structured data from PNG files, PDFs, and documents. Start with 50 GB free, no credit card required.