Introduction
For anyone who loved Aperture, the move to Photos was a painful one. You needed to adjust your habits and things did not quite work the way you wanted them to. But with these tools, you can regain control of your photo library and treat it like the sophisticated database it actually is. I want to stop struggling with the Photos app - and get back to enjoying my photographs.
Interaction with the Apple Photos library is usually restricted to the official app’s GUI. While functional for casual use, it often feels like a “walled garden” for those who want more control over their metadata, automation, or directory structures. Fortunately, a suite of powerful tools exists to bridge this gap, allowing you to treat your photo library like the sophisticated database it actually is.
In this post, we’ll explore how to use Power Photos to manage large macOS photo libraries, osxphotos for deep database querying, PhotoScript and JXA for automation, and Phoenix Slides for lightning-fast browsing of your assets.
Managing Multiple Libraries with PowerPhotos
If your goal is to merge or reorganize multiple large libraries, PowerPhotos is the industry standard. While osxphotos handles the data extraction, PowerPhotos excel at high-level library management.
Key Operations:
- Merging Libraries: Combine multiple libraries into a single one while intelligently handling duplicates.
- Moving Assets: Drag and drop pictures and albums between different libraries, ensuring metadata (like captions and keywords) and original image fidelity are preserved.
- Library Comparison: Find and eliminate duplicate photos across different libraries to reclaim disk space.
- Non-Invasive Browsing: Browse your libraries without having to wait for the main Photos app to open and load the entire database.
Core Capabilities with osxphotos
The osxphotos project provides a powerful command-line interface (CLI) and Python API. It acts as a bridge to the undocumented Photos.sqlite database, enabling operations that are impossible or tedious in the Photos app.
1. Robust Querying
The query command allows for complex filtering:
- Search by metadata: Find photos by keyword, person, album, or folder.
- Technical filters: Filter by camera model, dimensions, orientation, or file type (e.g., RAW vs. JPEG).
- AI-driven filters: Query based on scene recognition labels stored by Apple’s media analysis.
2. Advanced Exporting
The export command is essential for customized backups:
- Metadata Preservation: Optionally write metadata back into exported files using
exiftool. - Custom Directory Structures: Organize exports into folders using templates (e.g.,
/{year}/{month}/{album}/). - Sidecar Support: Export metadata into industry-standard XMP sidecar files.
3. Programmatic Access (Python API)
For developers, osxphotos provides a comprehensive Python API for custom automation:
import osxphotos
photosdb = osxphotos.PhotosDB()
for photo in photosdb.photos(keywords=["Vacation"]):
print(f"Found: {photo.filename}, Original Name: {photo.original_filename}")
Real-Time Interaction with PhotoScript
While osxphotos excels at reading the database directly, its sister project PhotoScript takes a different approach. It acts as a Python wrapper around the Apple Photos AppleScript interface.
This enables direct interaction with a running instance of Photos, making it ideal for:
- UI Automation: Creating albums and importing photos in real-time.
- Library Management: Moving items between albums programmatically or toggling “Favorite” status via script.
- iCloud Sync: Edits made via PhotoScript are officially registered and propagate correctly to iCloud.
Scripting with JavaScript (JXA)
If you prefer JavaScript over Python, you can use JavaScript for Automation (JXA). This allows you to integrate with the Photos app using modern JS syntax.
// Example: Print filenames of selected photos
const Photos = Application("Photos");
for (const photo of Photos.selection()) {
console.log(photo.filename());
}
JXA is particularly useful because changes are sync-safe and the environment is built directly into macOS via the Script Editor or osascript.
Fast Browsing with Phoenix Slides
When you need to browse images directly on disk—whether they are exported files or the internal “Originals” folder—Phoenix Slides is the tool of choice. Unlike the standard Photos app, it doesn’t require importing or database management.
Why it complements your workflow:
- Speed: Blazingly fast browsing even with thousands of images.
- Recursive Search: Automatically find images in deep subfolders.
- Direct Access: Perfect for a “sanity check” of your
osxphotosexports.
Conclusion: Why This Matters
For anyone who loved Aperture, the move to Photos was a painful one. You needed to adjust your habits and things did not quite work the way you wanted them to. But with these tools, you can regain control of your photo library and treat it like the sophisticated database it actually is.
Taking control of your Photos library isn’t just about technical flair; it’s about Data Portability and Digital Preservation. Using these tools ensures your metadata isn’t trapped in a proprietary database but is preserved in your files, making your memories accessible for decades to come.