All posts
TutorialApril 26, 20265 min read

How to extract EXIF and GPS metadata from a photo

Where the photo was taken, what camera made it, when it was shot, even the focal length — every JPEG carries it. Here's how to read EXIF from a photo and the privacy lines you should know about.

By Dawid Sibinski

Every photo from a phone or modern camera carries EXIF — a metadata block with the camera model, exposure settings, timestamp, and (often) the GPS coordinates of where the photo was taken. Extracting it is trivial. The interesting question is what you do with the data.

Quick check, no install

macOS Preview: Tools → Show Inspector → the (i) info icon → GPS tab. Windows: right-click → Properties → Details. Both surface the location if it's there, and let you remove it.

ExifTool: the canonical command-line tool

exiftool photo.jpg dumps every EXIF, IPTC, XMP, and maker-note tag. Useful flags:

  • exiftool -GPSLatitude -GPSLongitude photo.jpg — just GPS
  • exiftool -all= photo.jpg — strip all metadata in place (with -overwrite_original to skip the backup file)
  • exiftool -csv -r folder/ — dump every photo in a folder to a single CSV

Python: Pillow + piexif, or exifread

from PIL import Image from PIL.ExifTags import TAGS, GPSTAGS img = Image.open("photo.jpg") exif = img._getexif() for tag_id, value in exif.items(): tag = TAGS.get(tag_id, tag_id) print(tag, value)

GPS coordinates come back as a tuple of (degrees, minutes, seconds) — convert to decimal with d + m/60 + s/3600 and apply the hemisphere sign from GPSLatitudeRef / GPSLongitudeRef. piexif and the newer pillow-heif handle HEIC/HEIF from iPhones.

Going from coordinates to a place

Once you have lat/lon, reverse-geocode with the Nominatim API (OpenStreetMap, free) or Google Maps Geocoding (paid, more accurate for addresses). Don't try to write your own — the edge cases around country borders and disputed regions get ugly fast.

What you can extract from a phone photo

  • GPS latitude and longitude (often), altitude, GPS timestamp
  • Camera make and model, lens
  • Date/time taken (and the time zone in newer iPhone shots)
  • Exposure: aperture, shutter speed, ISO, focal length
  • Orientation, software used ("Photos 1.0" tells you it was edited on iOS Photos)
  • Sometimes: device serial number, owner name, even Wi-Fi SSID on jailbroken phones

Privacy — both directions

If you're posting photos publicly, strip EXIF first: most social platforms do this automatically, most blog uploads don't. exiftool -all= photo.jpg or any image editor's "export without metadata" works. The risk isn't theoretical — there are well-documented cases of GPS-tagged photos revealing home addresses of people who thought they were anonymous.

If you're extracting from photos you didn't take, treat GPS metadata like personally identifying data — because that's what it is.

Edge cases

  • Screenshots have no EXIF — they're rendered, not captured.
  • Most messaging apps strip EXIF on send (WhatsApp, iMessage). Email attachments usually don't.
  • RAW files (CR2, NEF, ARW) have richer EXIF than the JPEG export. Read with exiftool, not Pillow.
  • There's no "IP address" in standard EXIF — that's a myth. The Wi-Fi SSID claim is real on some platforms; the IP one isn't.

More on tutorial

Stop reading, start extracting

Drop a PDF or image into ExtractFox and get structured data back in seconds.

Try a free extraction →