Mac Photos

From Torben's Wiki

MacOS Photos App

My Cleanup Workflow

1. Organize all photos into albums

Using Smart Album to find missing:

Album is not Any

Album examples:

  • 2024/240615 Some Event
  • Documents
  • Home
  • Kid 1
  • Kid 2
  • Kids
  • Me
  • People
  • Screenshots
  • Sports/Jogging
  • Sports/Cycling

2. Add missing locations

Using Smart Album to find missing:

Photo is not tagged with GPS

ways to set locations:

  • manual Copy & Paste from other photo in Photo App via Menu -> Image -> Location (works also for multiple photos)
  • manual set location text in Photo App via (I) -> Location, via copy paste of common locations from text/Excel file (works also for multiple photos)
  • using Python osxphotos, see below
osxphotos add-locations --selected --window 1H --dry-run

3. Add missing faces

Using Smart Album to find missing:

Person is 

(with empty input)

Interact with Python

Copy missing locations from neighboring photos

Install osxphotos

python3 -m pip install osxphotos

Update later

python3 -m pip install --upgrade osxphotos

Run in dry-run mode on selected photos

osxphotos add-locations --selected --window 1H --dry-run

Copy locations from GPX file

Install

osxphotos install gpxpy
wget https://raw.githubusercontent.com/RhetTbull/add_photo_locations_from_gpx/refs/heads/main/add_photo_locations_from_gpx.py

Run in dry-run mode on selected photos

osxphotos run add_photo_locations_from_gpx.py --selected --dry-run myFile.gpx

if time zone info is missing in photo, set UTC offset parameter like --offset +05:45:00

Extract exif data e.g. gps location

osxphotos query --selected --json | jq '.[].exif_info'

via Python and copy location to clipboard

import subprocess
import osxphotos

def copy_to_clipboard(text) -> None:
    process = subprocess.Popen(["pbcopy"], stdin=subprocess.PIPE)
    process.communicate(input=text.encode("utf-8"))

if __name__ == "__main__":
    photosdb = osxphotos.PhotosDB()
    try:
        while 1:
            results = photosdb.query(osxphotos.QueryOptions(selected=True))
            for photo in results:
                print(photo.original_filename, photo.date)
                s = f"{photo.latitude},{photo.longitude}"  # type: ignore
                print(s)
                copy_to_clipboard(s)
            input("Press Enter for next image...")
    except KeyboardInterrupt:
        pass

Links