How to Extract Metadata from JPG and JPEG Photos
JPEG photos embed metadata in APP marker segments that most image viewers never show you. This guide explains where EXIF, IPTC, and XMP data physically lives inside a JPEG file, then walks through five extraction methods from command-line tools to AI-powered batch processing.
How JPEG Metadata Is Stored
Every JPEG file starts with a two-byte Start of Image (SOI) marker, 0xFFD8. What follows before the actual image data is a series of APP markers, and these markers are where metadata lives.
APP1 (0xFFE1): EXIF and XMP
The APP1 marker holds the most commonly accessed metadata. When a camera saves a photo, it writes EXIF data into APP1 as a TIFF-structured block. This includes camera settings, timestamps, GPS coordinates, and thumbnail images. A single JPEG can contain 50 or more distinct EXIF fields, from shutter speed and focal length to altitude and compass bearing.
XMP metadata also uses the APP1 marker but with a different identifier string. Where EXIF uses the "Exif\x00\x00" header, XMP identifies itself with "http://ns.adobe.com/xap/1.0/\x00". The XMP packet is stored as UTF-8 XML and has a size limit of roughly 64 KB because it can't span multiple segments.
APP13 (0xFFED): IPTC
The APP13 marker stores IPTC-IIM (International Press Telecommunications Council) metadata. News agencies and stock photo libraries rely on IPTC fields for editorial information: headline, caption, photographer credit, copyright notice, keywords, and location data. IPTC predates EXIF and was the first standardized metadata format for digital images.
Reading order matters. A metadata extraction tool needs to scan through these markers sequentially from the SOI until it reaches the Start of Scan (SOS) marker, which signals the beginning of compressed image data. All metadata segments sit before SOS. Any tool that jumps straight to image data will miss every metadata field.
Most guides skip this binary structure and go straight to ExifTool commands. Understanding where the data physically sits helps when you hit edge cases: conflicting timestamps between EXIF and IPTC, XMP data that contradicts EXIF GPS coordinates, or metadata that survives one editing tool but disappears in another. The marker that stores the data determines which tool can read it.
What Metadata Lives Inside a JPEG Photo
JPEG metadata falls into three distinct standards, each designed for different users and workflows.
EXIF (Exchangeable Image File Format)
EXIF fields are written by the camera at capture time. The most commonly extracted fields include:
- Camera identification. Make, Model, and Software fields tell you exactly which device and firmware produced the image.
- Capture settings. ExposureTime, FNumber, ISOSpeedRatings, FocalLength, WhiteBalance, Flash, and MeteringMode record the technical parameters.
- Timestamps. DateTimeOriginal records when the shutter fired. DateTimeDigitized records when the sensor data was processed. DateTime records when the file was last modified.
- GPS data. GPSLatitude, GPSLongitude, GPSAltitude, GPSTimeStamp, and GPSImgDirection can pinpoint where and which direction the camera was pointing.
- Image properties. ImageWidth, ImageLength, Orientation, ColorSpace, and XResolution describe the output image.
- Thumbnail. Most JPEGs embed a small preview image (typically 160x120 pixels) in the EXIF data for quick rendering.
IPTC (International Press Telecommunications Council)
IPTC fields are editorial. Photographers and editors add them after capture to describe what the image shows and who owns it:
- Headline, Caption/Abstract, and Keywords for search and categorization
- Byline (photographer), Credit, Source, and Copyright Notice for rights management
- City, Province/State, Country for location context independent of GPS
XMP (Extensible Metadata Platform)
Adobe created XMP as a flexible container that can hold both EXIF and IPTC data plus custom schemas. XMP uses XML syntax, making it human-readable and extensible. Lightroom, Photoshop, and Capture One write their editing history, ratings, color labels, and collection assignments to XMP. XMP can also replicate EXIF and IPTC fields, which sometimes leads to conflicts when one standard is updated but not the other.
Extract JPEG Metadata with ExifTool
ExifTool is the standard command-line tool for metadata work. It reads all three metadata standards from JPEG files and supports batch processing across directories.
Read All Metadata
exiftool photo.jpg
This prints every metadata field ExifTool can find, grouped by source (EXIF, IPTC, XMP, ICC Profile, JFIF). For a typical camera JPEG, expect 80 to 150 fields.
Show Detailed Tag Information
exiftool -a -s -G1 photo.jpg
The -a flag shows duplicate tags (common when EXIF and XMP store the same field). The -s flag prints tag names instead of descriptions. The -G1 flag prefixes each tag with its group name, so you can tell whether a DateTimeOriginal came from EXIF or XMP.
Extract GPS Coordinates
exiftool -GPSPosition photo.jpg
This returns latitude and longitude in a human-readable format. For machine-readable decimal degrees:
exiftool -n -GPSLatitude -GPSLongitude photo.jpg
The -n flag disables the default degree-minute-second formatting and outputs raw numeric values.
Batch Export to CSV
exiftool -csv -r -Model -DateTimeOriginal -GPSLatitude -GPSLongitude *.jpg > metadata.csv
This extracts four specific fields from every JPEG in the current directory and writes them to a CSV file. The -r flag recurses into subdirectories. You can import this CSV directly into a spreadsheet or database for analysis.
Remove All Metadata
exiftool -all= photo.jpg
This strips EXIF, IPTC, XMP, and ICC profile data while preserving the image. ExifTool saves a backup with the _original suffix. To skip the backup:
exiftool -all= -overwrite_original photo.jpg
Stripping metadata before sharing photos online is a practical privacy step. GPS coordinates in EXIF data can reveal your home address, workplace, or travel patterns with meter-level accuracy.
Extract and Organize Photo Metadata Automatically
Fast.io Metadata Views let you describe the fields you need in plain language and extract structured data from JPEG photos, PDFs, and documents. Start with 50 GB free, no credit card required.
Read JPEG EXIF Data with Python
Python has several libraries for JPEG metadata extraction, each with different tradeoffs between coverage and simplicity.
Pillow: Built-in EXIF Access
Pillow reads EXIF data through the getexif() method and maps numeric tag IDs to human-readable names with the ExifTags.TAGS dictionary:
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
img = Image.open("photo.jpg")
exif_data = img.getexif()
for tag_id, value in exif_data.items():
tag_name = TAGS.get(tag_id, tag_id)
print(f"{tag_name}: {value}")
For GPS data, you need an extra step. GPS fields are nested inside a sub-IFD:
gps_info = exif_data.get_ifd(0x8825)
if gps_info:
for tag_id, value in gps_info.items():
tag_name = GPSTAGS.get(tag_id, tag_id)
print(f"{tag_name}: {value}")
Pillow handles EXIF well but doesn't read IPTC or XMP data natively.
ExifRead: Lightweight and Dependency-Free
ExifRead is a pure Python library that reads EXIF data without any compiled dependencies:
import exifread
with open("photo.jpg", "rb") as f:
tags = exifread.process_file(f)
for tag, value in tags.items():
print(f"{tag}: {value}")
ExifRead parses the APP1 marker directly, so it catches fields that higher-level libraries sometimes miss. It supports JPEG, TIFF, WebP, and HEIC formats.
PyExifTool: Full ExifTool Coverage from Python
PyExifTool wraps the ExifTool command-line application, giving you access to all three metadata standards (EXIF, IPTC, XMP) from Python:
import exiftool
files = ["photo1.jpg", "photo2.jpg", "photo3.jpg"]
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 keeps a single ExifTool process running across calls, which makes batch processing faster than spawning a new process for each file. It requires ExifTool to be installed on the system, but it reads every metadata field that ExifTool supports.
Which Library to Choose
Use Pillow when you're already doing image processing and only need EXIF fields. Use ExifRead when you want a lightweight, zero-dependency option for EXIF extraction. Use PyExifTool when you need IPTC, XMP, and EXIF coverage with batch performance.
Browser-Based JPEG Metadata Viewers
When you need to check a photo's metadata without installing software, online viewers parse the JPEG structure in the browser. Most of these tools process the file client-side, so the image data doesn't leave your machine.
Jeffrey's Image Metadata Viewer is one of the oldest and most thorough online EXIF tools. It reads EXIF, IPTC, XMP, ICC profiles, and JFIF data from JPEG files. The output shows every field organized by metadata standard, and it highlights GPS coordinates on a map when present.
ExifInfo.org provides a clean interface that focuses on the most useful fields: camera model, exposure settings, GPS location, and timestamps. It strips away the noise of obscure MakerNote fields and presents what most people actually want to see.
Pic2Map specializes in GPS extraction. Upload a JPEG and it plots the capture location on an interactive map. It also shows the camera direction if GPSImgDirection is present.
MetaStripper combines viewing and removal. Upload a JPEG to see its metadata, then download a cleaned copy with all EXIF, IPTC, and XMP fields removed. This is useful when you want to inspect what data a photo contains before stripping it for sharing.
Online viewers work well for quick inspections and one-off checks. For recurring workflows or batch processing, a command-line or programmatic approach will save time and give you more control over which fields to extract.
Automate JPEG Metadata Extraction at Scale
Extracting metadata from a few photos is simple with any of the tools above. Processing thousands of images in a production workflow, an asset library, or a forensic investigation requires automation.
Build a Processing Pipeline with ExifTool
ExifTool handles batch extraction natively. To extract metadata from every JPEG in a directory tree and output structured JSON:
exiftool -json -r -ext jpg -ext jpeg /photos/ > metadata.json
The -json flag produces output you can parse with any programming language. The -ext flags limit processing to JPEG files. Feed this JSON into a script that inserts records into PostgreSQL, Elasticsearch, or a search index.
For event-driven processing, cloud platforms offer trigger-based approaches. An AWS Lambda function triggered by S3 uploads can run ExifTool in a container layer. Google Cloud Functions with Cloud Storage triggers provide the same pattern. Both scale horizontally but require you to maintain the infrastructure and extraction logic yourself.
AI-Powered Extraction with Fast.io
Fast.io's Metadata Views offer a different approach to metadata extraction at scale. Instead of writing parsing rules or maintaining ExifTool scripts, you describe the fields you want in natural language. The AI designs a typed schema (text, integer, decimal, date, boolean, URL, or JSON) and extracts matching data from every file in a workspace.
For JPEG photos, you could define fields like "camera model," "capture date," "GPS coordinates," "copyright holder," or "color space" and Metadata Views will populate a sortable, filterable spreadsheet. Adding new columns doesn't require reprocessing existing files. The system works with JPEGs alongside PDFs, Word documents, spreadsheets, and other file types in the same workspace.
Agents can also trigger extraction and query results through the Fast.io MCP server, which enables fully automated metadata pipelines. Files arrive in a workspace, get analyzed, and route to the right workflow based on their properties. Combined with Intelligence Mode for semantic search, your JPEG library becomes queryable by both structured metadata fields and visual content.
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
How do I view metadata on a JPEG file?
The quickest method is ExifTool on the command line: run 'exiftool photo.jpg' to see all metadata fields including EXIF camera settings, IPTC editorial fields, and XMP properties. On Mac, you can also right-click a JPEG in Finder, select Get Info, and see basic metadata under More Info. On Windows, right-click the file, select Properties, then the Details tab. For more thorough inspection without installing software, online viewers like Jeffrey's Image Metadata Viewer parse all three metadata standards directly in the browser.
What metadata is stored in a JPG photo?
A JPG photo can store three types of metadata. EXIF data records camera settings (shutter speed, aperture, ISO, focal length), timestamps, GPS coordinates, orientation, and a thumbnail image. IPTC data stores editorial information like headlines, captions, photographer credits, copyright notices, and keywords. XMP data can hold copies of EXIF and IPTC fields plus custom properties like editing history, ratings, and color labels. All three types sit in APP marker segments before the compressed image data.
How do I extract GPS data from a JPEG?
With ExifTool, run 'exiftool -GPSPosition photo.jpg' for human-readable coordinates or 'exiftool -n -GPSLatitude -GPSLongitude photo.jpg' for raw decimal values. In Python, use Pillow's getexif() method and access the GPS IFD at tag 0x8825. The GPS data includes latitude, longitude, altitude, timestamp, and sometimes compass direction. Not all JPEGs contain GPS data. Smartphones embed it by default unless location services are disabled for the camera app, while standalone cameras only include it if they have a built-in GPS receiver or a connected phone.
Can you remove metadata from a JPEG before sharing?
Yes. ExifTool strips all metadata with 'exiftool -all= photo.jpg', removing EXIF, IPTC, XMP, and ICC profile data while keeping the image intact. On iPhone, open the photo in Photos, tap the info button, tap Adjust Location, then tap No Location to remove GPS data before sharing. On Android, the Gallery app's share options include a Remove Location toggle. Online tools like MetaStripper let you upload a JPEG and download a cleaned copy. Removing metadata before sharing photos publicly is a good privacy practice, since GPS coordinates in EXIF data can reveal home addresses and daily routines.
What is the difference between EXIF, IPTC, and XMP metadata?
EXIF is written by the camera at capture time and records technical settings like exposure, focal length, and GPS coordinates. IPTC is added by photographers and editors to describe the content with headlines, captions, keywords, and copyright information. XMP is Adobe's extensible format that can hold both EXIF and IPTC data plus custom schemas like editing history, ratings, and collection assignments. In a JPEG file, EXIF and XMP share the APP1 marker (with different identifiers), while IPTC lives in the APP13 marker.
Do social media platforms strip JPEG metadata on upload?
Most major platforms strip EXIF data from uploaded photos. Facebook, Instagram, Twitter/X, and LinkedIn remove GPS coordinates, camera settings, and other EXIF fields during processing. Some platforms retain IPTC copyright fields, but this varies. If you need metadata to survive social sharing, embed copyright information in both IPTC and XMP fields, since platforms handle each standard differently. For professional distribution where metadata preservation matters, share files through a platform that doesn't re-encode uploads.
Related Resources
Extract and Organize Photo Metadata Automatically
Fast.io Metadata Views let you describe the fields you need in plain language and extract structured data from JPEG photos, PDFs, and documents. Start with 50 GB free, no credit card required.