How to Extract Metadata From Images

10 May 2026 1,475 words

How to Extract Metadata From Images

Digital images contain significantly more information than just the visual pixels. Every time a digital camera or smartphone captures a photo, it embeds metadata — known as EXIF (Exchangeable Image File Format) data — that records camera settings, timestamps, GPS coordinates, device information, and more. This metadata is useful for photographers organizing their libraries, developers building image processing applications, investigators verifying photo authenticity, and privacy-conscious users auditing what information their images reveal. This guide explains how to extract and interpret image metadata using online tools and code.

What EXIF Data Contains

EXIF data is structured into several groups, each containing specific tags. Here is a comprehensive breakdown of the information typically stored in image files:

Camera Information

  • Camera make and model (for example, "Apple iPhone 15 Pro Max" or "Canon EOS R5")
  • Lens model and focal length (for example, "50mm f/1.4")
  • Aperture setting (f-stop value such as f/2.8)
  • Shutter speed (for example, 1/250 second)
  • ISO sensitivity (for example, ISO 400)
  • Exposure mode (manual, aperture priority, shutter priority, automatic)
  • White balance setting (auto, daylight, cloudy, tungsten, fluorescent)
  • Flash mode (fired, did not fire, red-eye reduction)
  • Metering mode (evaluative, center-weighted, spot)
  • Digital zoom ratio

Date and Time Information

  • Original capture timestamp with timezone offset
  • Date and time when the file was digitized
  • Date and time when the file was last modified
  • Sub-second time precision for high-speed photography analysis

GPS Coordinates

  • Latitude and longitude in degrees, minutes, and seconds
  • Altitude above or below sea level
  • Direction the camera was facing (bearing)
  • GPS timestamp
  • GPS processing method
  • Satellite information for GPS fix quality

Image Characteristics

  • Image dimensions in pixels (width and height)
  • Horizontal and vertical resolution (DPI)
  • Orientation flag (indicating whether the camera was held in portrait or landscape mode)
  • Color space (sRGB, Adobe RGB, ProPhoto RGB)
  • Compression type and quality
  • Pixel aspect ratio
  • ICC color profile information

Copyright and Author Information

  • Copyright holder name and notice
  • Artist or photographer name
  • Image description and caption
  • Software used to create or edit the image
  • Rating and labels applied by photo management software

Online Tool

The easiest way to extract metadata without any technical setup is to use the Image Metadata Extractor tool on Help2Code. Upload any JPEG, PNG, TIFF, or WebP image, and the tool displays all available EXIF tags in a clean, organized table. The tool runs entirely in your browser, so your images are never uploaded to a server — all processing happens locally using JavaScript. It also provides a summary view highlighting the most commonly requested fields and an export option to download the metadata as JSON for programmatic analysis.

Extracting Metadata with Code

JavaScript in the Browser

The following JavaScript code reads EXIF data from an image file using the FileReader API and a lightweight EXIF parser:

function extractMetadata(file) {
  return new Promise((resolve, reject) => {
    const reader = new FileReader();
    reader.onload = (e) => {
      try {
        const view = new DataView(e.target.result);
        const exifData = parseExif(view);
        resolve(exifData);
      } catch (err) {
        reject(err);
      }
    };
    reader.onerror = () => reject(new Error('Failed to read file'));
    reader.readAsArrayBuffer(file);
  });
}

function parseExif(view) {
  // Check for JPEG SOI marker
  if (view.getUint16(0, false) !== 0xFFD8) {
    throw new Error('Not a valid JPEG file');
  }
  // Parse APP1 EXIF segment
  let offset = 2;
  while (offset < view.byteLength) {
    if (view.getUint16(offset, false) === 0xFFE1) {
      const exifLength = view.getUint16(offset + 2, false);
      const exifView = new DataView(view.buffer, offset + 4, exifLength - 2);
      return readExifTags(exifView);
    }
    offset += 2 + view.getUint16(offset + 2, false);
  }
  throw new Error('No EXIF data found');
}

For production use, consider using established libraries like exif-js, exifreader, or piexifjs which handle all the low-level parsing and edge cases.

Python

Python provides excellent support for EXIF extraction through the Pillow library. Here is a comprehensive example:

from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
import json

def extract_exif(image_path):
    image = Image.open(image_path)
    exif_data = image._getexif()
    
    if exif_data is None:
        print("No EXIF data found in this image.")
        return {}
    
    decoded = {}
    for tag_id, value in exif_data.items():
        tag_name = TAGS.get(tag_id, tag_id)
        
        if tag_name == "GPSInfo":
            gps_data = {}
            for gps_tag_id in value:
                gps_tag_name = GPSTAGS.get(gps_tag_id, gps_tag_id)
                gps_data[gps_tag_name] = str(value[gps_tag_id])
            decoded[tag_name] = gps_data
        else:
            decoded[tag_name] = str(value)
    
    return decoded

# Usage
metadata = extract_exif('photo.jpg')
print(json.dumps(metadata, indent=2))

Command Line with exiftool

For advanced metadata extraction, exiftool by Phil Harvey is the most comprehensive tool available. It supports hundreds of file formats and thousands of metadata tags:

# Extract all metadata
exiftool photo.jpg

# Extract only GPS coordinates
exiftool -gpsposition -n photo.jpg

# Extract metadata as JSON
exiftool -json photo.jpg > metadata.json

# Remove all metadata (useful for privacy)
exiftool -all= photo.jpg

# Extract only camera info
exiftool -make -model -lens -aperture -shutterspeed -iso photo.jpg

# Generate a CSV report for multiple images
exiftool -csv -r -make -model -datetimeoriginal -gpslatitude -gpslongitude /path/to/photos/ > metadata.csv

Privacy Warning

EXIF data can reveal sensitive information that you may not intend to share. GPS coordinates embedded in photos taken at your home address, workplace, or children's school can compromise personal privacy and physical security. Camera serial numbers can be used to trace images back to a specific device. Timestamps can reveal your daily routines and travel patterns.

Before sharing photos online — on social media, messaging apps, or your personal website — consider removing EXIF metadata. Most social media platforms strip EXIF data automatically, but this is not guaranteed. Use the Help2Code Image Metadata Extractor to review what data your images contain, and use the image optimizer tools to strip metadata before sharing.

Complete EXIF Tag Reference

Here are some of the most commonly encountered EXIF tags and their meanings:

Tag ID Tag Name Description
0x010F Make Camera manufacturer
0x0110 Model Camera model number
0x0112 Orientation Image rotation (1=normal, 3=180, 6=90 CW, 8=90 CCW)
0x011A XResolution Horizontal pixel density
0x011B YResolution Vertical pixel density
0x0128 ResolutionUnit Unit of measurement for DPI
0x0131 Software Software used to process the image
0x0132 DateTime File modification date and time
0x013E WhitePoint White balance chromaticity
0x013F PrimaryChromaticities Primary color chromaticity
0x0211 YCbCrCoefficients Color space transformation coefficients
0x0213 YCbCrPositioning Chrominance subsampling position
0x0214 ReferenceBlackWhite Black and white reference points
0x8298 Copyright Copyright notice
0x829A ExposureTime Shutter speed in seconds
0x829D FNumber Aperture f-stop value
0x8822 ExposureProgram Exposure program mode
0x8827 ISOSpeedRatings ISO sensitivity value
0x9000 ExifVersion EXIF version string
0x9003 DateTimeOriginal Original capture timestamp
0x9004 DateTimeDigitized Digitization timestamp
0x9101 ComponentsConfiguration Color component configuration
0x9102 CompressedBitsPerPixel Compression ratio
0x9201 ShutterSpeedValue Shutter speed in APEX format
0x9202 ApertureValue Aperture in APEX format
0x9203 BrightnessValue Brightness in APEX format
0x9204 ExposureBiasValue Exposure compensation
0x9205 MaxApertureValue Maximum aperture of lens
0x9206 SubjectDistance Distance to subject
0x9207 MeteringMode Metering method
0x9208 LightSource Type of light source
0x9209 Flash Flash status and mode
0x920A FocalLength Lens focal length in mm
0x927C MakerNote Camera manufacturer proprietary data
0x9286 UserComment User-added comments
0x9290 SubsecTime Sub-second timestamp precision
0xA001 ColorSpace Color space (sRGB, Adobe RGB)
0xA002 PixelXDimension Image width in pixels
0xA003 PixelYDimension Image height in pixels
0xA005 InteroperabilityIFD Interoperability data pointer
0xA20E FocalPlaneXResolution Focal plane X resolution
0xA20F FocalPlaneYResolution Focal plane Y resolution
0xA210 FocalPlaneResolutionUnit Resolution unit for focal plane
0xA217 SensingMethod Image sensor type
0xA300 FileSource File source (DSC = digital still camera)
0xA301 SceneType Scene type (directly photographed)

By understanding what metadata your images contain and how to extract it, you can better manage your digital photo library, protect your privacy, and integrate image processing into your development projects.


About this article

Learn how to extract EXIF and metadata from images using online tools and code.

Help2Code Logo
Menu