Python app to work with pictures and associated metadata from Apple Photos on macOS
open sourceMITself-hostablefree
OSXPhotos is a command-line tool and Python package for the Apple Photos library on a Mac. It queries the library's database (file names, keywords, people, albums, places and more) and exports originals and edited versions with their metadata, into folders and file names built from a template, and can export again incrementally. With --download-missing it has Photos download originals that are only in iCloud Photos (Optimize Mac Storage) before exporting them. It also reads iPhoto libraries, and its export and query commands and Python API run on Linux against a copied library. Rhet Turnbull created it in 2019.
Problems it solves
- export my whole Apple Photos library to folders by date with the original file names
- back up my Mac's Photos library, edits, keywords and albums included, to an external drive
- my Photos library is set to Optimize Mac Storage and I need the full-size originals out of it
- write the titles, keywords and people from Apple Photos into the exported files' metadata
- query the Apple Photos database from a Python script
- leave Apple Photos for another photo app without losing my albums and people tags
- copy every photo of one person in my Photos library to a folder
- export only the photos added since my last backup from Apple Photos
Features
- query the Photos database: keywords, persons, albums, places, labels
- export originals and edited versions with metadata
- templates for folder and file names
- incremental exports
- --download-missing fetches originals from iCloud through Photos
- XMP sidecars and writing metadata with exiftool
- reads iPhoto 9.6.1 libraries
- Python API
- pre-built executables, uv, pip, Homebrew tap and MacPorts installs
Limitations
- Can't read shared albums on macOS 261
- Doesn't handle audio-only files stored in Photos: only images and videos1
- Most features need macOS: on Linux only the export and query commands and the Python API work1
Capabilities
| Has a command line tool | plan not known |
|---|
Alternatives
The same job
These do what OSXPhotos does.
- iCloud Photos Sync One-way sync engine for the iCloud Photos Library into the native file system
- iCloud Photos Downloader (icloudpd) A command-line tool to download photos from iCloud
- kei Fast, parallel backups for cloud-hosted photos and videos
