Skip to content

hegdem85/pyexifkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📷 ExifKit

A comprehensive Python library for extracting, analyzing, and manipulating image EXIF metadata.

Features

  • Extract EXIF data — Camera info, exposure settings, GPS coordinates, dates, and more
  • Structured data models — Clean Python dataclasses for all metadata categories
  • GPS support — Coordinates, altitude, Google Maps links
  • Privacy tools — Strip all metadata from images
  • Compare images — Diff EXIF data between two photos
  • Batch processing — Process entire directories, export to CSV
  • Sort & rename — Organize photos by date into folders, rename by timestamp
  • Duplicate detection — Find potential duplicates via EXIF fingerprinting
  • Thumbnail extraction — Extract embedded EXIF thumbnails
  • CLI included — Full command-line interface
  • Export — JSON, CSV, dict formats

Installation

pip install -e .

Quick Start

from exifkit import ExifKit

# Extract EXIF data
kit = ExifKit("photo.jpg")
data = kit.extract()

# Human-readable summary
print(data.summary())

# JSON export
print(data.to_json())

# Access structured fields
print(f"Camera: {data.camera.camera_name}")
print(f"Exposure: {data.exposure.exposure_triangle}")
print(f"Date: {data.datetime_info.best_date}")

# GPS info
if data.gps.is_valid:
    print(f"Location: {data.gps.coordinates}")
    print(f"Maps: {data.gps.google_maps_url}")

API Reference

ExifKit (core class)

Method Description
extract() Extract all EXIF data → ExifData
strip_exif(output) Remove all metadata (privacy)
copy_exif_to(target, output) Copy EXIF to another image
auto_orient(output) Auto-rotate by EXIF orientation
to_json(output) Export as JSON string/file
to_csv_row() Flat dict for CSV export
get_thumbnail() Extract embedded thumbnail bytes
save_thumbnail(output) Save thumbnail to file

Static Methods

Method Description
ExifKit.compare(file1, file2) Diff EXIF between two images
ExifKit.batch_extract(dir) Extract from all images in dir
ExifKit.batch_to_csv(dir, output) Export dir EXIF to CSV
ExifKit.sort_by_date(dir, output) Sort into date folders
ExifKit.rename_by_date(dir) Rename files by EXIF date
ExifKit.find_duplicates(dir) Find potential duplicates
ExifKit.find_images_with_gps(dir) Find geotagged images
ExifKit.has_gps(file) Quick GPS check

Data Models

  • ExifData — Top-level container with .summary(), .to_json(), .to_dict()
  • GPSInfo.latitude, .longitude, .altitude, .google_maps_url, .coordinates
  • CameraInfo.make, .model, .lens_model, .camera_name, .lens_name
  • ExposureInfo.aperture, .shutter_speed, .iso, .focal_length, .exposure_triangle
  • ImageInfo.width, .height, .resolution, .megapixels, .file_size_human
  • DateTimeInfo.date_taken, .date_digitized, .best_date

CLI Usage

# Extract EXIF (human-readable)
exifkit extract photo.jpg

# Extract as JSON
exifkit extract photo.jpg --json

# Strip metadata
exifkit strip photo.jpg -o photo_clean.jpg

# Compare two images
exifkit compare img1.jpg img2.jpg

# Batch export to CSV
exifkit batch ./photos -o metadata.csv

# Sort into date folders
exifkit sort ./photos ./sorted --format "%Y/%Y-%m"

# Rename by date (dry run)
exifkit rename ./photos --pattern "%Y%m%d_%H%M%S"

# Rename for real
exifkit rename ./photos --pattern "%Y%m%d_%H%M%S" --execute

# Find geotagged images
exifkit gps ./photos

# Find duplicates
exifkit duplicates ./photos

Context Manager

with ExifKit("photo.jpg") as kit:
    data = kit.extract()
    print(data.camera.camera_name)

Supported Formats

JPEG, TIFF, PNG, WebP, HEIC/HEIF

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages