ExifTool Forum

ExifTool => Newbies => Topic started by: laika57 on October 03, 2021, 12:25:37 PM

Title: How to mass import metadata (json) to images.
Post by: laika57 on October 03, 2021, 12:25:37 PM
Hi all,

I'm trying to migrate from Google Photos to iCloud, but encountering a bit of a hiccup. Namely, thousands of my pictures from Google takeout are missing metadata on the photo itself, even though each associated .json file has the correct metadata.

Since the json files have the required metadata, what kind of a command line would I use to mass apply metadata to the photos? I am pretty much a complete noob with using Terminal and command line applications, so any help would be very useful.

I am using Mac, and processing jpg, jpeg, and cr2. I have tried looking up previous posts, but I lack the expertise to piece together what others have said into usable commands.
Title: Re: How to mass import metadata (json) to images.
Post by: StarGeek on October 03, 2021, 01:17:23 PM
Quote from: laika57 on October 03, 2021, 12:25:37 PMNamely, thousands of my pictures from Google takeout are missing metadata on the photo itself, even though each associated .json file has the correct metadata.

Have you actually checked to see if the metadata is missing using exiftool?

Google photos does not remove any metadata from files uploaded to it.  For some reason, a lot of people online think that it does but when actually checked, it's not missing.

What is missing is any information that you added through the Google Photos website.  If you added data on the website, that will be contained in the json files.

If you still feel you need to go through with it, first thing is that you want to fix the names of any json files that have copy numbers added.  When downloading a file that has the same filename as another, google adds a copy number to the files.  In the case of the image, it would look like this
DSC00041(2).JPG
but the json file is put after the image extension
DSC00041.JPG(2).json
For exiftool to work, it needs to be
DSC00041(2).JPG.json

In order to do this, run the command in this post (https://exiftool.org/forum/index.php?topic=12882.msg69636#msg69636).  After that, see this StackOverflow answer (https://stackoverflow.com/a/42914024/3525475) for the command.  You might also search these forums (https://www.google.com/search?q=site:exiftool.org%20google+takeout++json) for a lot more examples.


Title: Re: How to mass import metadata (json) to images.
Post by: laika57 on October 05, 2021, 04:51:14 AM
Thank you for your help!

I'm not entirely sure how to check if the metadata was even missing with exiftools like you mentioned, but at least it seemed to not be attached when I checked the jpg info in Finder. However, I was able to solve it after reading through the posts that you linked with the following command:

exiftool -r -d %s -tagsfromfile "%d/%F.json" "-MDItemFSCreationDate<phototakentimetimestamp" -ext jpg -overwrite_original (insert file directory)

When first running the command it gave me an error but then prompted me to download some software, and then it worked just fine after that.

Thanks again for the help!
Title: Re: How to mass import metadata (json) to images.
Post by: Phil Harvey on October 05, 2021, 07:02:12 AM
Quote from: laika57 on October 05, 2021, 04:51:14 AM
When first running the command it gave me an error but then prompted me to download some software, and then it worked just fine after that.

Interesting.  What version of MacOS, and what software did you need to download?  Apple was threatening to drop Perl from the built-in software -- has this happened already?  You shouldn't need anything else to run ExifTool.

- Phil
Title: Re: How to mass import metadata (json) to images.
Post by: laika57 on October 05, 2021, 07:40:57 AM
I'm running Mojave (10.16.6), so still an older version. Unfortunately I don't remember what software it downloaded, but it only happened when I tried to use the MDItemFSCreationDate command, if that's any help?
Title: Re: How to mass import metadata (json) to images.
Post by: Phil Harvey on October 05, 2021, 12:49:44 PM
Ah, right.  That would be the Mac "setfile" utility for writing MDItemFSCreationDate.  Thanks.

- Phil
Title: Re: How to mass import metadata (json) to images.
Post by: Hubert on October 05, 2021, 03:45:03 PM
Quote from: Phil Harvey on October 05, 2021, 07:02:12 AM
Apple was threatening to drop Perl from the built-in software -- has this happened already? 

Perl 5, version 30, subversion 3 (v5.30.3) is still alive and kicking in the public betas of macOS 12 Monterey.  :)
Title: Re: How to mass import metadata (json) to images.
Post by: Phil Harvey on October 06, 2021, 07:08:24 AM
Quote from: Hubert on October 05, 2021, 03:45:03 PM
Perl 5, version 30, subversion 3 (v5.30.3) is still alive and kicking in the public betas of macOS 12 Monterey.  :)

*thumbs up emoji*

- Phil