← Back to Projects
PythonScriptsTools

PhotoSort

Python scripts that read GPS EXIF data from photos and sort them into region folders automatically — UK, Caribbean, or anywhere else.

Two Python scripts for sorting a backlog of unsorted holiday photos by where they were taken.

extract_gps.py scans a folder, reads the GPS coordinates from each image’s EXIF data, and prints a clustered summary — how many photos came from roughly the same location, with sample filenames. Useful for getting a quick read on what’s in an unsorted pile before committing to a sort.

sort_by_region.py does the actual work. It reads the same GPS data, classifies each file into a named region (UK, Caribbean, or Other), and moves it into the corresponding subfolder. Files with no GPS tag go into a No GPS folder rather than being lost. Handles JPG, PNG, DNG, MP4, and DOCX — non-image formats skip the GPS lookup and land in No GPS.

Both scripts run directly against a NAS share path, so there’s no need to copy thousands of photos locally first.


Features

  • Reads GPS EXIF coordinates from JPG, PNG, and DNG files
  • Clusters photos by rough location (1° grid, ~111km) for a quick overview
  • Auto-sorts into named region folders — UK, Caribbean, No GPS, Other
  • Handles mixed media — skips GPS lookup for video and non-image files
  • Runs against a NAS share — no need to copy files locally first
  • Reports skipped files (locked, no EXIF, no GPS tag)