How to merge image with his .json file (Google Photos takeout)

Started by Nick_0278, April 15, 2020, 03:17:17 PM

Previous topic - Next topic

shauryainks

Quote from: StarGeek on January 07, 2021, 01:19:32 PM
Though thinking further, my tests didn't include a file that didn't have any embedded timestamps.  And I can't recall offhand if Google Photos saves that original file system timestamp and displayed that as the date online.

I can see how it might appear that Google is deleting data if it is saving the file system timestamp for sorting purposes.  I'll have to do some testing.
hi i need help regarding it plz help me i dont know anything fo coding thanks


StarGeek

You don't give us anything that we can use to help you.  What command did you try?  What was the output?
* 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).

George.e

Amazing! thank you everyone

I did have to jump around a couple articles just to get the start running, as i have no idea about cmd... so for those really with no idea what you are doing, this worked for me:

download the software file it will likely be called exiftool(-k)

Rename exiftool to remove the (-k) part.  Depending upon your settings it will end up as either exiftool or exiftool.exe

Open up a CMD window hitting WindowKey+R, type "CMD" and hit enter

Drag the exiftool icon onto the CMD window

Hit space

Copy and paste this into the CMD window:
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

Hit space

Drag the top folder from your unzipped Google Takout onto the CMD window

Hit Enter

Exiftool will then start processing all your files.

This will copy all GPS location data, tags, captions, descriptions, dates and time taken information to ALL files (-ext "*") within the specified directory, excluding JSON (--ext json).

Phil Harvey

Hi George,

One minor correction:

Quote from: George.e on June 21, 2021, 06:33:29 AM
Copy and paste this into the CMD window:

Since you already dragged exiftool.exe onto the cmd window, the command you paste shouldn't start with "exiftool" again.

- 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 ($).

Kestouf

Hello
I allow myself to answer this post because I have the same problem as you to import the metadata contained in the Json file into the Jpeg file.
I tried the command line from "George.e" but the result is "No file specified"
So I have a "GooglePhoto" folder with several subfolders
--GooglePhoto
| - Folder1
| - Folder2
| - Folder3
   | - SubFolder1
   | - SubFolder2
| - Folder4


In each subfolder I have photos and their Json file like this:
FB_IMG_1512824510746.jpg
FB_IMG_1512824510746.jpg.json
IMG_20171105_150325.jpg
IMG_20171105_150325.jpg.json
....



Can you please help me get the command line to import the Json metadata into the photo file from all subfolders of "GooglePhoto"

Thank you

StarGeek

Did you make edits on the Google Photos website?  If you did not, you do not need to copy the data from the json files. Google Photos does not remove metadata from the files.
* 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).

Kestouf

Hello
I'm sorry, but I just got over it. I had a problem with the path to my folder.
Thank you for your reply.

raring_ringtail

Hi everyone,
This tool has saved my life.

I'd add my experience, replying to @StarGeek & @Nick_0278 :

Some of my photos contains all the datas correctly, while other doesn't not contain the "Data Taken" field.
I noticed that the first one are the photos tooked by the device camera's, while the second one are the photos received on Whatsapp or Screnshoot for example.

So i think that this depends on the source that has the photo.

I've another question:
Exists on exiftool an option that permits to copy all the information in the JSON file to the image, without specify in the command all the option that i want to copy?

Phil Harvey

ExifTool will automatically copy same-named tags between files with this command:

exiftool -tagsfromfile FILE1 FILE2

But unfortunately the tags in the JSON file will probably all have different names.  To deal with this, a simple argfile could be made to map between the names.  You can see examples of these here.  I don't think anyone has yet made an argfile to convert from Google takeout JSON tags.

- 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 ($).

StarGeek

Quote from: Phil Harvey on November 13, 2021, 10:12:41 AM
But unfortunately the tags in the JSON file will probably all have different names.

That is correct.  There's only a couple json tags that match standard image tags, Title and Description.  Everything else has to be copied from the json name to an image name.
* 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).

StarGeek

Quote from: raring_ringtail on November 13, 2021, 09:24:33 AM
I noticed that the first one are the photos tooked by the device camera's, while the second one are the photos received on Whatsapp or Screnshoot for example.

Yes.  These files never had any metadata to begin with.  In the case of WhatsApp and similar social media sites, they strip all metadata for privacy reasons.  Screenshots never had data to begin with.

But in most cases, these file types usually have filenames that are based upon the date/time the file was created and can be set using the command in the third paragraph of FAQ #5 (starts "Having said this").  This is important to take note of because the timestamp in the Google takeout will be in UTC, which will be different than the actual time indicated by the filename.
* 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).

sammartin

thanks all,  this solved my "date taken is wrong when exporting photos from google take out".  hopefully will help someone find this thread from google


dt2022

Hello,

I recently downloaded my google takeout metadata (3/10). Upon scrolling through the photos, I noticed photos that date back to 2013. In fact, my photos only date from 2013-2019, despite taking numerous photos between 2019-now. Not sure where those photos are being backed up too...

However, my question is this, for images that are originally dated back to 2013/2014, etc.. I haven't touched or modified them in years. However, when I look at the .json data that goes along with the files it shows at under "photoLastModifiedTime" "formatted" as dates that are in 2022, even as recent as March 2022 (prior to me initiating the data download.
Does anyone know how this works? Is someone modifying my photos?

Thank you in advance. I am very new to this.

DT

StarGeek

No idea how google uses the photoLastModifiedTime property.  Maybe last time you did something with the image on the website or made a shared link to it or even last time you looked at it. Maybe Google updated it's database on those files.  No real way to know without a lot of testing spanning a long time.  I wouldn't think it's worth worrying about.

The only useful timestamp in the json file is the PhotoTakenTimeTimestamp, as that will be either the embedded timestamp or the file create/modify date from when you uploaded it if the embedded timestamp didn't exist.

You should take note though that Google did not remove any embedded data from your images.  The only data "lost" would be file system related ones like FileCreateDate/FileModifyDate and that's because the file isn't a local disk file anymore.
* 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).