mvgijssel / apple-photos-export-timestamp-fix

Updated image exif data to correct photo created timestamp
Apache License 2.0
7 stars 0 forks source link

Apple Photos

When exporting unmodified originals from Apple Photos the timestamps can be wrong. Sometimes this information is still available within the photo EXIF data, but sometimes you're not that lucky and the one and only date is wrong.

Info Apple Photos Info Finder
Details Apple Photos Details Finder

This script fixes these cases by copying the time information from Apple Photos into the photo EXIF data.

Getting started

  1. Clone the project to your Desktop

    git clone https://github.com/mvgijssel/apple-photos-export-timestamp-fix.git ~/Desktop/photofix
  2. Export unmodified originals from Apple Photos and save into ~/Desktop/photofix/images/apple

Export Apple Photos
  1. Make sure to export photos to their Moment Name subfolder
Export Apple Photos Subfolder
  1. Run this script
    cd  ~/Desktop/photofix
    ./photofix apple ./images/apple --dest ./images/apple/final

NOTE: assuming the iCloud Photos library is located at ~/Pictures/Photos Library.photoslibrary

Google Photos

When exporting photos from Google Photos the timestamps are not preserved within the photo EXIF data, this data is provided in a "sidecar" json file.

Fixing my timestamps

  1. Clone the project, for example to your Desktop

    git clone https://github.com/mvgijssel/apple-photos-export-timestamp-fix.git ~/Desktop/photofix
  2. Navigate into the installation directory

    cd ~/Desktop/photofix
  3. Install all the dependencies

    brew install exiftool
    bundle install
  4. Export Google Photos using https://takeout.google.com/settings/takeout

Depending on the number of photos you have, the photos will need to be downloaded in multiple archives. Try to make the archives as large as possible (50GB), smaller archives can miss necessary json information.

  1. Move all the .zip archives to a single folder: ~/Desktop/photofix/images/google

  2. Navigate to the images folder

    cd ~/Desktop/photofix/images/google
  3. Unzip all the archives using the following command

for file in $(ls); do; echo "Processing $file"; unzip $file -d "unzip-$file"; done
  1. Merge all the unzipped folders

    mkdir merged
    for folder in $(ls | grep "unzip-"); do; echo "Merging $folder"; cp -lR $folder/Takeout/Google\ Foto_s/* merged/; done
  2. Remove the unzipped folders

    for folder in $(ls | grep "unzip-"); do; echo "Removing $folder"; rm -rf $folder; done
  3. Navigate to the installation directory

    cd ~/Desktop/photofix
  4. Run script to fix google photo timestamps and export to ~/Desktop/photofix/final

    ./photofix google ~/Desktop/photofix/images/google --dest ~/Desktop/photofix/google/final

Remove duplicates

dupeGuru

  1. Install dupeGuru tool https://dupeguru.voltaicideas.net

Cleanup

  1. Remove some leftover empty folders
find ~/Desktop/images -type d -empty -print -delete
  1. Delete photos from Google Photo using https://github.com/mrishab/google-photos-delete-tool