How to mass import metadata (json) to images.

Started by laika57, October 03, 2021, 12:25:37 PM

Previous topic - Next topic

laika57

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.

StarGeek

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.  After that, see this StackOverflow answer for the command.  You might also search these forums for a lot more examples.


* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

laika57

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!

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

laika57

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?

Phil Harvey

Ah, right.  That would be the Mac "setfile" utility for writing MDItemFSCreationDate.  Thanks.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Hubert

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.  :)

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).