AI & Agents

How to Extract Metadata from RAW Camera Files (CR2, NEF, ARW)

RAW camera files like Canon CR2, Nikon NEF, and Sony ARW store far richer metadata than JPEGs, including proprietary MakerNote tags, lens correction profiles, and full shooting parameters. This guide walks through extracting that metadata with command-line tools, Python libraries, and GUI applications, plus how to handle vendor-specific tags and batch processing across large photo libraries.

Fast.io Editorial Team 10 min read
Metadata extraction and structured data analysis from files

What Makes RAW Metadata Different from JPEG

Every digital photo contains EXIF metadata recording camera settings, timestamps, and GPS coordinates. But RAW files go much further than the compressed JPEG your camera can also produce.

A JPEG file typically carries a few dozen standardized EXIF tags. A Canon CR2 file from a recent EOS camera can contain over 300 unique metadata tags. That difference comes down to three things.

First, RAW files preserve the full TIFF-based IFD (Image File Directory) structure that JPEG strips down. Where a JPEG keeps one flattened set of EXIF data, a CR2 file contains multiple IFDs, each holding different metadata groups including the main image parameters, thumbnail data, and sensor-specific information.

Second, RAW files include MakerNote blocks. These are proprietary metadata sections where Canon, Nikon, and Sony each store hundreds of manufacturer-specific tags. MakerNote data includes internal focus point maps, sensor temperature readings, shutter actuation counts, white balance coefficients, dust-delete data, and lens distortion correction profiles. None of this appears in a JPEG exported from the same camera.

Third, RAW files store 12 to 14 bits of color data per channel compared to JPEG's 8 bits. The metadata reflects this richer tonal range with tags for black level, white level, linearization tables, and color matrix coefficients that describe exactly how the sensor captured light.

The practical result: if you need to audit shooting conditions, verify equipment used, track shutter wear, or reconstruct the exact camera configuration for a shot, the RAW file is the only reliable source.

Extracting RAW Metadata with ExifTool

ExifTool by Phil Harvey is the standard tool for reading metadata from RAW files. It supports CR2, NEF, ARW, DNG, ORF, RW2, RAF, and virtually every other RAW format produced by digital cameras.

Install ExifTool

On macOS, install via Homebrew:

brew install exiftool

On Ubuntu/Debian:

sudo apt install libimage-exiftool-perl

On Windows, download the standalone executable from exiftool.org and add it to your PATH.

Read All Metadata from a RAW File

The simplest command dumps every tag ExifTool can decode:

exiftool IMG_4521.CR2

This prints standard EXIF data (shutter speed, aperture, ISO, focal length, date/time, GPS coordinates) plus Canon-specific MakerNote data (focus mode, white balance setting, color temperature, lens model, serial number, image stabilization state, and dozens more).

Extract Specific Tags

When you only need particular fields, specify them by name:

exiftool -Model -LensModel -ShutterCount -FocusMode -SerialNumber IMG_4521.CR2

For Nikon NEF files, useful MakerNote tags include:

exiftool -ShutterCount -VibrationReduction -ActiveD-Lighting -LensID -FocusDistance DSC_0892.NEF

For Sony ARW files:

exiftool -Model -LensType -FocusMode2 -SteadyShot -SequenceLength DSC01234.ARW

Export to JSON or CSV

For programmatic processing, export metadata as JSON:

exiftool -json -r /path/to/raw-files/ > metadata.json

Or export specific fields to CSV:

exiftool -csv -FileName -Model -LensModel -FocalLength -ISO -ShutterSpeed -Aperture -GPSLatitude -GPSLongitude /path/to/raw-files/ > metadata.csv

View MakerNote Groups

To see only the manufacturer-specific tags, filter by group:

exiftool -Canon:all IMG_4521.CR2
exiftool -Nikon:all DSC_0892.NEF
exiftool -Sony:all DSC01234.ARW

This isolates the proprietary data that distinguishes RAW metadata from standard EXIF.

Structured metadata indexing from raw camera files

Extracting RAW Metadata with Python

Python has strong library support for reading RAW file metadata. The right library depends on whether you need just the metadata or also want to process the image data itself.

exifread (Metadata Only)

The exifread library parses EXIF data from RAW files without loading the full image. It handles CR2, NEF, and other TIFF-based RAW formats:

pip install exifread
import exifread

with open('IMG_4521.CR2', 'rb') as f:
    tags = exifread.process_file(f, details=True)

for tag_name, tag_value in tags.items():
    print(f"{tag_name}: {tag_value}")

The details=True parameter includes MakerNote tags. Without it, exifread skips proprietary manufacturer data.

Different RAW formats return different tag sets. A CR2 file might return Canon-specific tags like MakerNote Tag 0x0095 for lens model data, while an NEF file returns Nikon-specific tags for VR settings and active D-Lighting state.

pyexiftool (ExifTool Wrapper)

If you need the full tag coverage of ExifTool in Python, pyexiftool wraps the command-line tool:

pip install pyexiftool
import exiftool

files = ['IMG_4521.CR2', 'DSC_0892.NEF', 'DSC01234.ARW']

with exiftool.ExifToolHelper() as et:
    metadata = et.get_metadata(files)
    for item in metadata:
        print(item.get('EXIF:Model'))
        print(item.get('MakerNotes:ShutterCount'))
        print(item.get('EXIF:LensModel'))

This approach gives you access to every tag ExifTool can read, including deeply nested MakerNote data, while keeping your workflow in Python.

rawpy (Image Data + Basic Metadata)

The rawpy library (a Python binding for LibRaw) focuses on image processing but also exposes basic metadata:

pip install rawpy
import rawpy

raw = rawpy.imread('DSC_0892.NEF')
print(f"Camera: {raw.color_desc}")
print(f"Raw type: {raw.raw_type}")
print(f"Num colors: {raw.num_colors}")
print(f"Raw pattern: {raw.raw_pattern.tolist()}")

rawpy is the right choice when you need to read the actual sensor data alongside metadata, for example when building a custom RAW processing pipeline. For metadata-only tasks, exifread or pyexiftool are lighter and faster.

Fastio features

Organize and Search Your Photo Archive

Upload RAW files to Fast.io and extract metadata into a searchable, sortable database. Metadata Views pull camera settings, GPS data, and lens info from your files automatically. 50 GB free, no credit card required.

Understanding MakerNote Tags Across Vendors

MakerNote is where the real depth of RAW metadata lives. Each camera manufacturer uses a proprietary encoding, which means the same conceptual information (lens data, focus info, sensor calibration) appears under completely different tag names and structures.

Canon MakerNote Structure

Canon stores MakerNote data in structured records. Key groups include:

  • CameraSettings: shooting mode, self-timer, flash mode, focus type, image size, metering mode, focus range, AF point
  • FocalLength: focal length values, focal plane measurements
  • ShotInfo: auto-ISO value, base ISO, measured EV, target aperture, target exposure time
  • CameraInfo: internal temperature, measured RGGB levels, color data version
  • LensModel: full lens name string
  • DustRemovalData: sensor dust map for post-processing removal

Canon's CameraInfo records are particularly complex. The encoding varies between camera models, and some values even switch byte order (endianness) within a single record. ExifTool handles this transparently, but if you are writing a custom parser, expect significant per-model variation.

Nikon MakerNote Structure

Nikon uses three different MakerNote formats across its camera line. Newer cameras (D500 and later, Z-series) use the most recent format, which Nikon encrypts for certain data blocks. The encryption has been reverse-engineered, so ExifTool and exiv2 can decrypt and read these tags.

Key Nikon MakerNote groups include:

  • LensData: lens ID, focus distance, focal length, aperture, lens F-stops (encrypted on newer models)
  • ShotInfo: sequence number, shutter count, active D-Lighting setting
  • VRInfo: vibration reduction mode and state
  • AFInfo2: focus point data, face detection status, AF area mode
  • ColorBalance: red, blue, green gain values for the specific lighting conditions

Sony MakerNote Structure

Sony ARW files embed MakerNote data in private IFD tags (tag IDs 0x2010, 0x2011, 0x2020). Sony's encoding is less documented than Canon's or Nikon's, but ExifTool has decoded a substantial portion.

Notable Sony-specific tags include:

  • FocusMode2: detailed AF mode beyond the basic EXIF FocusMode
  • SteadyShot: in-body image stabilization state
  • SequenceLength: burst shot count
  • CreativeStyle: picture profile settings
  • LensType: Sony and third-party lens identification

Sony restricts write access to ARW metadata more than Canon or Nikon do. ExifTool can read Sony MakerNote data but cannot write to many of these proprietary fields.

Batch Processing and Common Workflows

Extracting metadata from one file is straightforward. The challenge with RAW files is scale. A single wedding shoot produces 2,000 to 5,000 RAW files. A commercial photography studio might archive tens of thousands per month.

Recursive Batch Extraction ExifTool handles directories recursively by default:

exiftool -r -csv -FileName -DateTimeOriginal -Model -LensModel -ISO -ShutterSpeed -Aperture -FocalLength /archive/2026/raw/ > shoot_metadata.csv

This traverses every subdirectory and processes any recognized image format, including mixed CR2/NEF/ARW folders. Processing speed depends on your storage, but ExifTool typically handles around 50 to 100 files per second for metadata-only reads.

Extracting Embedded Thumbnails

Every RAW file contains one or more embedded JPEG previews at different resolutions. Extracting these is far faster than rendering the RAW data:

exiftool -b -PreviewImage IMG_4521.CR2 > preview.jpg
exiftool -b -JpgFromRaw IMG_4521.CR2 > full_preview.jpg

Canon CR2 files typically embed three previews: a small thumbnail, a medium preview, and a full-resolution JPEG rendering. Nikon NEF files include similar previews. Sony hides its highest-quality previews in private MakerNote sections, but ExifTool can extract those too.

Batch extract all previews from a folder:

exiftool -b -JpgFromRaw -w _preview.jpg /path/to/raw-files/

Extracting GPS Data from RAW Files

If your camera has a built-in GPS (common on mirrorless bodies) or you used an external GPS logger, the coordinates are embedded in standard EXIF GPS tags, regardless of file format:

exiftool -GPSLatitude -GPSLongitude -GPSAltitude -GPSDateTime -n DSC_0892.NEF

The -n flag outputs coordinates as decimal numbers instead of degrees/minutes/seconds, which is more useful for mapping applications and databases.

For cameras without GPS, you can geolocate RAW files by matching timestamps to a GPX track from a phone or dedicated GPS logger:

exiftool -geotag track.gpx /path/to/raw-files/

Comparing Metadata Across Files

When you need to verify that a batch of files was shot with consistent settings:

exiftool -T -FileName -ISO -ShutterSpeed -Aperture -WhiteBalance *.CR2

The -T flag produces tab-separated output, which pastes cleanly into spreadsheets for comparison.

Managing RAW Metadata at Scale with Fast.io

Command-line tools work well for individual photographers. Teams working with large RAW archives, where multiple people need to search, filter, and extract metadata from thousands of files, need something more structured.

Fast.io's Metadata Views turn uploaded files into a queryable database. Describe the metadata fields you want extracted in plain language, and the AI designs a typed schema and populates a sortable, filterable spreadsheet. For photo archives, you might define columns for camera model, lens, focal length, ISO, GPS coordinates, and shooting date. The system matches files in your workspace and extracts those fields automatically.

This is different from manually running ExifTool on each file. Metadata Views work across your entire workspace, handle mixed file types (RAW files alongside PDFs, documents, and other assets), and let you add new columns without reprocessing existing files. The extracted data lives alongside your files in a shared workspace where team members can search, filter, and sort.

For studios that receive RAW files from multiple photographers, Fast.io's Receive shares let clients upload files directly without email or FTP. Once the files land in a workspace with Intelligence enabled, they are automatically indexed for semantic search and AI chat. You can ask questions like "show me all shots taken with the 70-200mm lens at ISO 800 or higher" and get results across your full archive.

Teams that need to build automated pipelines around metadata extraction can use Fast.io's MCP server or webhooks to trigger processing when new files arrive. An agent can watch for incoming RAW files, extract metadata, and organize files into project folders based on camera, date, or client, all without manual intervention.

Fast.io's free plan includes 50 GB of storage and 5,000 monthly credits with no credit card required, which is enough to get started with a working metadata extraction workflow for smaller archives.

Frequently Asked Questions

How do I view metadata in CR2 files?

The fast way is ExifTool. Run `exiftool yourfile.CR2` in a terminal to see all metadata including Canon MakerNote tags. On macOS, Preview shows basic EXIF data under Tools > Show Inspector. For a GUI option, Adobe Bridge and the free XnView MP both display CR2 metadata in detail panels. To see only Canon-specific proprietary data, use `exiftool -Canon:all yourfile.CR2`.

What metadata is stored in NEF files?

Nikon NEF files store standard EXIF data (shutter speed, aperture, ISO, focal length, date, GPS), IPTC fields (caption, copyright, keywords), XMP data, and Nikon-specific MakerNote tags. The MakerNote section includes lens identification, focus distance, vibration reduction state, active D-Lighting settings, shutter actuation count, white balance coefficients, and AF point data. Some of this data is encrypted on newer Nikon models, but tools like ExifTool can decrypt and display it.

Can I extract GPS data from RAW camera files?

Yes. If your camera has built-in GPS or you used a GPS accessory, the coordinates are stored in standard EXIF GPS tags inside the RAW file. Use `exiftool -GPSLatitude -GPSLongitude -n yourfile.NEF` to extract decimal coordinates. If your camera lacks GPS, you can geotag RAW files after the fact by matching timestamps to a GPX track file using `exiftool -geotag track.gpx /path/to/raw-files/`.

What tools read Sony ARW metadata?

ExifTool provides the most complete ARW metadata reading, including Sony's proprietary MakerNote tags stored in private IFD sections. The Python exifread library also handles ARW files with the `details=True` parameter. Sony's own Imaging Edge Desktop software reads ARW metadata but only exposes a subset. Adobe Bridge, Lightroom, and the free XnView MP can all display ARW EXIF data. Note that Sony restricts write access to many proprietary ARW metadata fields, so read-only extraction is more reliable than editing.

What is a MakerNote in camera metadata?

A MakerNote is a proprietary metadata block embedded inside the EXIF data of a photo file. Each camera manufacturer (Canon, Nikon, Sony, Fujifilm, and others) uses this space to store detailed technical information that goes beyond standard EXIF tags. MakerNote data can include shutter actuation counts, internal sensor temperature, lens distortion correction profiles, autofocus point maps, and white balance calibration values. The encoding is manufacturer-specific, so you need tools like ExifTool that have reverse-engineered these formats to read MakerNote data reliably.

How do I extract embedded thumbnails from RAW files?

RAW files contain embedded JPEG previews at various resolutions. With ExifTool, use `exiftool -b -PreviewImage yourfile.CR2 > preview.jpg` for a medium-resolution preview or `exiftool -b -JpgFromRaw yourfile.CR2 > full_preview.jpg` for the full-resolution embedded JPEG. To batch-extract previews from an entire folder, use `exiftool -b -JpgFromRaw -w _preview.jpg /path/to/raw-files/`. This is faster than rendering the RAW sensor data.

Related Resources

Fastio features

Organize and Search Your Photo Archive

Upload RAW files to Fast.io and extract metadata into a searchable, sortable database. Metadata Views pull camera settings, GPS data, and lens info from your files automatically. 50 GB free, no credit card required.