February 27, 2022
If this is TLDR, skip to the bottom.
Moving from Google Photos to some other photo management software (Apple Photos in my case) is annoyingly difficult. Sure, you can easily take out all your photos by simply using Google Takeout, but there’s some annoying gotchas.
image.jpg
, Google Photos saves metadata like GPS data, photo timestamp, etc.. into image.jpg.json
instead of embedding it into image.jpg
’s exif data.json
doesn’t always work.json
file with another (e.g. image.jpg, image-edited.jpg
both correspond to image.jpg.json
)img(1).jpg
maps to img.jpg(1).json
instead of img(1).jpg.json
It almost feels like Google’s intentionally making it subtly difficult to migrate away from Google Photos…
I googled a bunch to look for a solution and found 2 useful but incomplete pages:
image.jpg
if image.jpg.json
existsDateTimeOriginal
EXIF field
DateTimeOriginal
field and drops useful GPS dataIf I refine the 2nd page’s heuristics a little bit, I can just rename the JSON files to be consistent and use the 1st page’s exiftool command!
I wrote a corresponding_json
function and iterated on it, starting with the simple heuristic of appending .json
to the media file name.
Iterating a few times, I noticed:
image-edited.jpg
generally corresponds to image.jpg
image-redigeret.jpg
that corresponds to image.jpg
.json
files appear to have cap of 51 characters (most of the time)
image(1).jpg
, then it can actually be 54 characters
(note that the (1)
didn’t count towards their 51 character limit)image.jpg
and image.mp4
, with image.jpg.json
as the metadata fileAccounting for all of this weirdness (source code here),
my corresponding_json
function was able to find the corresponding json for all ~7,000 photos/videos I had taken out.
To make the exiftool command linked above work as expected, I just essentially did
copy_file(corresponding_json('image.jpg'), 'image.jpg.json')
./process.py <PATH-TO-GOOGLE-TAKEOUT-FOLDER>
exiftool -r -d %s -tagsfromfile "%d/%F.json" "-GPSAltitude<GeoDataAltitude" "-GPSLatitude<GeoDataLatitude" "-GPSLatitudeRef<GeoDataLatitude" "-GPSLongitude<GeoDataLongitude" "-GPSLongitudeRef<GeoDataLongitude" "-Keywords<Tags" "-Subject<Tags" "-Caption-Abstract<Description" "-ImageDescription<Description" "-DateTimeOriginal<PhotoTakenTimeTimestamp" -ext "*" -overwrite_original -progress --ext json <PATH-TO-GOOGLE-TAKEOUT-FOLDER>