0

My photo editing workflow uses Lightroom to develop the photos before exporting to disk and importing into Photos.app.

The problem is that the photos in Photos.app have their date set to the import date (or maybe the export date from Lightroom), which means that their dates are wrong and they're out-of-order, especially compared to my iPhone pictures.

I've finished developing a few hundred photos and they're already in Photos.app, and I've done some organising, so I don't want to delete and reimport them.

How can I fix the dates on these photos? I've checked the JPEG exports from Lightroom and they do contain the correct date/time in the EXIF data. But it seems that Photos.app has used the file creation date instead.

The data still exists because when I export unmodified originals from Photos.app I can still see the date.

get info info in preview.app

1 Answer 1

1

Here is an Applescript that fixes the problem. It works by exporting each original photo to disk, then reading the EXIF tag, parsing the date and setting that back in Photos.app.

It uses exiftool, which can be installed with Homebrew.

The script could be found in https://gist.github.com/joerick/a68ecc083e4dbcedb8737f6a5b524ef5

-- create a folder for use by the script and set the path to it here
set thepath to alias "Macintosh HD:Users:joerick:Desktop:Scratch" as text

tell application "Photos"
    set photos to every media item of container "DateFix"
    repeat with mediaitem in photos
        tell application "Finder" to delete every item of folder thepath
        export {mediaitem} to thepath with using originals
        tell application "Finder" to set theExport to item 1 of folder thepath
        
        set theCommand to "/opt/homebrew/bin/exiftool -S -DateTimeOriginal " & (quoted form of POSIX path of (theExport as alias))
        
        set exifOutput to do shell script theCommand
        
        set resultDate to the current date
        
        set the year of resultDate to (text 19 thru 22 of exifOutput)
        set the month of resultDate to (text 24 thru 25 of exifOutput)
        set the day of resultDate to (text 27 thru 28 of exifOutput)
        set the hours of resultDate to (text 30 thru 31 of exifOutput)
        set the minutes of resultDate to (text 33 thru 34 of exifOutput)
        set the seconds of resultDate to (text 36 thru 36 of exifOutput)
        
        set the date of mediaitem to resultDate
        
    end repeat
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .