bulk join json with jpg from Google Takeout
Exiftool now has the ability to do this as of ver 10.47.
In my testing, I've seen two different formats for the json filename, some where it is filename.ext.json
and some where it is filename.json
(no extension in the json filename). Here are two command to cover either situation. If you have a mixtures, as I do, run both.
Files with extension in the json filenameexiftool -tagsfromfile '%d/%F.json' '-ImageTag<JsonTag' FileOrDir
Files without extension in the json filenameexiftool -tagsfromfile '%d/%f.json' '-ImageTag<JsonTag' FileOrDir
Replace FileOrDir
with the file or directory you wish to process. Replace ImageTag
with the name of the tag in the image you want to copy to. Replace JsonTag
with the name of the tag from the json file you wish to copy from. If you are on Windows instead of linux, use double quotes instead of single quotes.
Here are some of the more useful tags that I've encountered in the json file and my suggestions where to copy them. Two of the tag names, Description and Title, are the same as the related XMP tags, so they don't need to be redirected into the image tag name and can be left simply as -Description
or -Title
in the above commands.
description: Description of the file. The appropriate placement for this would be IPTC:Caption-Abstract, XMP:Description, and EXIF:ImageDescription. You could copy these with '-Caption-Abstract<Description'
, -Description
, or '-ImageDescription<Description'
.
title: Name of the uploaded file. This can be copied into Title
, ObjectDescription
or PreservedFileName
.
people: Not sure but I'm guessing that if the file has had people tagged in a program such as Picasa, this would be the list of names, most likely from the RegionPersonDisplayName
.
url: This is an URL that the image can be downloaded from. WARNING: It is a publicly shared URL and even if the image is marked private, it can still be downloaded with this URL.
GeoInfoAltitude_, GeoInfoLatitude_, and GeoInfoLongitude_: If the uploaded file was geotagged, these will be the Altitude, Latitude, and Longitude for the image. These would best be copied into GPSAltitude
, GPSLatitude
, GPSLatitudeRef
, GPSLongitude
, and GPSLongitudeRef
. Because of the nature of GPS tags (unsigned), image that are in the Western and/or Southern hemisphere must also have the Ref tags set.
Example commands:
Copy gps tagsexiftool -tagsfromfile '%d/%F.json' '-GPSAltitude<GeoDataAltitude' '-GPSLatitude<GeoDataLatitude' '-GPSLatitudeRef<GeoDataLatitude' '-GPSLongitude<GeoDataLongitude' '-GPSLongitudeRef<GeoDataLongitude' FileOrDir
Copy Keywords:exiftool -tagsfromfile '%d/%F.json' '-Keywords<Tags' '-Subject<Tags' FileOrDir
Copy Description:exiftool -tagsfromfile '%d/%F.json' '-Caption-Abstract<Description' '-ImageDescription<Description' -Description FileOrDir
Copy all the data from the JSON to the files, modifying the original files (2020):
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 jpg -overwrite_original FileOrDir
Edit (Jan 2018): As always, Google will change everything. The above GeoInfo* tags are deprecated according to the comment below and have been replaced by GeoDataAltitude, GeoDataLatitude, and GeoDataLongitude.
Edit (Oct 2020): Update commands for 2020 JSON format
Exiftool can read Json files, so if there are other changes, running the command exiftool -s FILE.Json
will list all the tags and available data that can be copied.
I'm sharing here what I ended up using
https://gist.github.com/tetebueno/5800504133709c9844bcd1779019d390
The ONLY case this code can't address is when the file has a very long name (more than 46 characters (?)) and has one of the auto-photos suffix (-edited
, etc.), because this ends up with something like:
very_large_file_name_..._foo-edited.jpg -> very_large_file_name_..._foo-edi.json
As an update in December 2020, as Pieter mentioned, there is a dedicated tool that took me ~5min to set up: https://github.com/mattwilson1024/google-photos-exif.
However, that doesn't solve the problem mentioned in the other answer (PHOTO_NAME(1).jpg
being confused with PHOTO_NAME.jpg(1).json
) as well as timezones. More importantly, none of the answers here overwrite the QuickTime- and PNG-specific tags.
I've found that this software https://metadatafixer.com/ was more straightforward. It costs money, but it was worth it.