ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Nick_0278 on April 15, 2020, 03:17:17 PM

Title: How to merge image with his .json file (Google Photos takeout)
Post by: Nick_0278 on April 15, 2020, 03:17:17 PM
Hello,

I wish to leave Google photos, and I have downloaded all my photos using Google Takeout. Now I have a boatload of folders containing both json files (that I think contains exif data) and images. The structure looks like this:

home/user/Takeout/Google Photos/2019-09-09/xy.jpg
home/user/Takeout/Google Photos/2019-09-09/xy.jpg.json.
or
home/user/Takeout/Google Photos/2020-01-09/zz.jpg
home/user/Takeout/Google Photos/2020-01-09/zz.jpg.json.

I want to join the json data with the correct images. I have been looking at Exiftool, but I founded only pieces of code like this
exiftool -tagsfromfile '%d/%F.json' '-ImageTag<JsonTag' FileOrDir
and don't know what and how exactly to replace the placeholders.

What I'm looking for is a way to join all the data with the correct images in bulk.
I'm trying to do this in linux command line. Is there a way/Whats the way to do this?

-Nick
Title: Re: How to merge image with his .json file
Post by: Phil Harvey on April 15, 2020, 03:39:42 PM
Hi Nick,

Basically you run this command on the json file to see that information it contains:

exiftool -s /home/user/Takeout/Google Photos/2019-09-09/xy.jpg.json

that will give the list of possible Json tags for '-ImageTag<JsonTag'

Then you just need to figure out where you want to write each tag in EXIF or XMP.  Then create one command to copy all the tags you want.

I can be more specific if you would attach one of the .json files here.

- Phil
Title: Re: How to merge image with his .json file
Post by: Nick_0278 on April 15, 2020, 03:43:14 PM
Thank you for the fast answer!
That's the output I get
ExifToolVersion                 : 11.85
FileName                        : 20170723_165646.jpg.json
Directory                       : .
FileSize                        : 714 bytes
FileModifyDate                  : 2020:02:28 01:07:32+01:00
FileAccessDate                  : 2020:04:15 20:40:27+02:00
FileInodeChangeDate             : 2020:04:15 20:14:48+02:00
FilePermissions                 : rw-rw-r--
FileType                        : JSON
FileTypeExtension               : json
MIMEType                        : application/json
CreationTimeFormatted           : 04.03.2019, 08:35:55 UTC
CreationTimeTimestamp           : 1551688555
Description                     :
GeoDataAltitude                 : 0.0
GeoDataLatitude                 : 42.68277777777777
GeoDataLatitudeSpan             : 0.0
GeoDataLongitude                : 23.289722222222224
GeoDataLongitudeSpan            : 0.0
GeoDataExifAltitude             : 0.0
GeoDataExifLatitude             : 42.68277777777777
GeoDataExifLatitudeSpan         : 0.0
GeoDataExifLongitude            : 23.289722222222224
GeoDataExifLongitudeSpan        : 0.0
ImageViews                      : 0
ModificationTimeFormatted       : 28.02.2020, 09:07:32 UTC
ModificationTimeTimestamp       : 1582880852
PhotoTakenTimeFormatted         : 23.07.2017, 13:56:46 UTC
PhotoTakenTimeTimestamp         : 1500818206
Title                           : 20170723_165646.jpg


That's one of my .json files:

- Nick
Title: Re: How to merge image with his .json file
Post by: Phil Harvey on April 15, 2020, 03:58:29 PM
Hi Nick,

OK, here is a command that will copy all of the useful information from json files like this to their corresponding jpg files in a directory:

exiftool -ext jpg -tagsfromfile %d%f.%e.json -description "-gpslatitude<geodatalatitude" "-gpslatituderef<geodatalatitude" "-gpslongitude<geodatalongitude" "-gpslongituderef<geodatalongitude" "-gpsaltitude<geodataaltitude" "-createdate<creationdatetimestamp" "-datetimeoriginal<phototakentimetimestamp" "-modifydate<modificationtimetimestamp" -d %s DIR

Here I am using the "%s" date/time formatting option to accept timestamps in seconds since the epoch, as done in this recent post (https://exiftool.org/forum/index.php?topic=10820.msg57584#msg57584).

- Phil
Title: Re: How to merge image with his .json file
Post by: Nick_0278 on April 15, 2020, 04:18:10 PM
Thanks, this is definitely the solution to my problem.
The only thing I'm not quite sure about is the last parameter of the command: 'DIR'

The thing is that I have a folder xy which contains many subfolders. These subfolders, (e.g. xy/xy2 | xy/xy2 | xy/xy3 ...)
contain the photos (e.g. xy/xy2/test.jpg). Now I want to use this command on all photos in the subfolders of xy/ but I don't know what I have to use for 'DIR'.

When I try:
exiftool -ext jpg -tagsfromfile %d%f.%e.json "-gpslatitude<geodatalatitude" "-gpslatituderef<geodatalatitude" "-gpslongitude<geodatalongitude" "-gpslongituderef<geodatalongitude" "-gpsaltitude<geodataaltitude" "-createdate<creationdatetimestamp" "-datetimeoriginal<phototakentimetimestamp" "-modifydate<modificationtimetimestamp" -d %s xy/

I get this 'error'
1 directories scanned
0 image files read


wich is logical, because in the directory itself aren't any photos.Do I need something like -r for recursively?

- Nick
Title: Re: How to merge image with his .json file
Post by: StarGeek on April 15, 2020, 05:58:55 PM
One very important thing to take note of is that Google Photos does not remove the metadata from the files.  The files you downloaded have exactly the same data that was there when uploaded.

Unless you have made modifications to the data on the Google Photos website, you do not need to merge the json data into the files.  The data is already there.

If you take a look and compare the GeoData* tags with the GeoDataExif* tags, you'll see that they are the same.  the GeoDataExif* tags are what was in the file when it was uploaded and are still in the file.
Title: Re: How to merge image with his .json file
Post by: Phil Harvey on April 15, 2020, 07:54:07 PM
If StarGeek is correct, all this is for nothing, but yes, the -r option processes subdirectories.

- Phil
Title: Re: How to merge image with his .json file
Post by: Nick_0278 on April 16, 2020, 01:45:12 AM
Thanks StarGeek, you're right. I don't understand why Google is giving you all the JSON files again. This was also the reason why I thought they were separate.

Nevertheless, I really thank you for your helpfulness.

So, that this thread can still be useful for someone, is that the result:
(If you've got also a Googlephotos export you do not need to do anything!)

To search only in the given directory for images and merge them with their json files:

exiftool -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s xy/

-Where xy/ must be replaced with your directory

To search also in Subfolder(s) of the given directory for images, and them merge them:

exiftool -r -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s xy/

- Where xy/ must be replaced with your directory
- the -r stands for recursively

EDIT:
should I somehow mark the thread as solved?

- Nicko
Title: Re: How to merge image with his .json file
Post by: StarGeek on April 16, 2020, 03:04:33 AM
Quote from: Nick_0278 on April 16, 2020, 01:45:12 AM
Thanks StarGeek, you're right. I don't understand why Google is giving you all the JSON files again.

Some people spend a lot of time editing what data they can on Google photos such as adding descriptions and setting locations for images that didn't have GPS coordinates.  That can be a lot of work that would otherwise be lost.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: h_correia on December 29, 2020, 05:19:38 PM
Hello all,

I registered here just to give feedback that I had the exact same issue as Nick_0278 and, contrary to his and StarGeek's experience, when I downloaded all my photos from Google photos, for some reason, many came with the original CreateDate and as such, MacOS correctly identifies the date in which they were taken, but others have a CreateDate and ModifyDate from the day I downloaded them. Curiously, the original PhotoTakenTimeTimestamp was still there in the json file, but not in the jpg. Using the commands above, I was able to correctly set the jpgs' PhotoTakenTimeTimestamp. I'm including an example from an uncorrected jpg and from a corrected one, in case anyone is curious.

Uncorrected:
ExifToolVersion                 : 12.13
FileName                        : 1470856620843.jpg
Directory                       : /Volumes/Data/Photos/Takeout/Google Photos/Photos from 2016/Test
FileSize                        : 177 KiB
FileModifyDate                  : 2020:12:19 19:33:18-03:00
FileAccessDate                  : 2020:12:29 18:55:24-03:00
FileInodeChangeDate             : 2020:12:19 19:33:18-03:00
FilePermissions                 : rwxrwxrwx
FileType                        : JPEG
FileTypeExtension               : jpg
MIMEType                        : image/jpeg
JFIFVersion                     : 1.01
ExifByteOrder                   : Little-endian (Intel, II)
Software                        : Picasa
ExifVersion                     : 0220
ColorSpace                      : sRGB
ExifImageWidth                  : 1080
ExifImageHeight                 : 1731
InteropIndex                    : R98 - DCF basic file (sRGB)
InteropVersion                  : 0100
ImageUniqueID                   : 31d453461447e1d40000000000000000
Compression                     : JPEG (old-style)
XResolution                     : 72
YResolution                     : 72
ResolutionUnit                  : inches
ThumbnailOffset                 : 312
ThumbnailLength                 : 5431
XMPToolkit                      : XMP Core 5.5.0
ImageWidth                      : 1080
ImageHeight                     : 1731
EncodingProcess                 : Baseline DCT, Huffman coding
BitsPerSample                   : 8
ColorComponents                 : 3
YCbCrSubSampling                : YCbCr4:2:0 (2 2)
ImageSize                       : 1080x1731
Megapixels                      : 1.9
ThumbnailImage                  : (Binary data 5431 bytes, use -b option to extract)



Corrected:

ExifToolVersion                 : 12.13
FileName                        : 1470266269146.jpg
Directory                       : /Volumes/Data/Photos/Takeout/Google Photos/Photos from 2016/Test
FileSize                        : 146 KiB
FileModifyDate                  : 2020:12:29 18:50:14-03:00
FileAccessDate                  : 2020:12:29 19:20:28-03:00
FileInodeChangeDate             : 2020:12:29 18:50:14-03:00
FilePermissions                 : rwxrwxrwx
FileType                        : JPEG
FileTypeExtension               : jpg
MIMEType                        : image/jpeg
JFIFVersion                     : 1.01
ExifByteOrder                   : Little-endian (Intel, II)
Software                        : Picasa
ModifyDate                      : 2020:09:06 06:33:47
ExifVersion                     : 0220
DateTimeOriginal                : 2016:08:03 23:17:49
CreateDate                      : 2016:08:09 21:01:22
ColorSpace                      : sRGB
ExifImageWidth                  : 1080
ExifImageHeight                 : 1731
InteropIndex                    : R98 - DCF basic file (sRGB)
InteropVersion                  : 0100
ImageUniqueID                   : 57918d38f50752ac0000000000000000
GPSVersionID                    : 2.3.0.0
GPSLatitudeRef                  : North
GPSLongitudeRef                 : East
GPSAltitude                     : 0 m
Compression                     : JPEG (old-style)
XResolution                     : 72
YResolution                     : 72
ResolutionUnit                  : inches
ThumbnailOffset                 : 554
ThumbnailLength                 : 4211
XMPToolkit                      : Image::ExifTool 12.13
Description                     :
ImageWidth                      : 1080
ImageHeight                     : 1731
EncodingProcess                 : Baseline DCT, Huffman coding
BitsPerSample                   : 8
ColorComponents                 : 3
YCbCrSubSampling                : YCbCr4:2:0 (2 2)
ImageSize                       : 1080x1731
Megapixels                      : 1.9
ThumbnailImage                  : (Binary data 4211 bytes, use -b option to extract)
GPSLatitude                     : 0 deg 0' 0.00" N
GPSLongitude                    : 0 deg 0' 0.00" E
GPSPosition                     : 0 deg 0' 0.00" N, 0 deg 0' 0.00" E

Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Aleburd on January 07, 2021, 11:39:43 AM
I have to agree with h_correia.  While StarGeek's experience is certainly true of the geo-location and camera information in the files I've seen from Google, the Capture Date has been removed from the EXIF file leaving the computer to see date created (the date the file was zipped by Google) as the capture date.  Most of the value in any photo library is to have the photos sorted by date and with this information only available in the json file there's no choice but to attempt a merge.  The good news is ExifTool works perfectly for this use case.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on January 07, 2021, 12:54:12 PM
Make sure you're not confusing the file system timestamps for the embedded time related tags. These timestamps you first see under Properties are file system timestamps, not embedded EXIF data.
(https://i.imgur.com/WC71mRa.png)

These are of course going to be lost because the file is no longer on the drive. And when you re-acquire the file, these are going to be set to when you downloaded the file, because it's a new and completely different file.  The contents are the same, but to the OS, it's a new file.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: 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.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Aleburd on January 07, 2021, 02:43:15 PM
Yeah - it's dropping the date taken date from the files.  I looked through the files and did find some that do have the capture date.  The inconsistency is a little concerning.  The attached image with the Windows details tab marry up to this json file:

{
  "title": "DSCN0524.JPG",
  "description": "",
  "imageViews": "0",
  "creationTime": {
    "timestamp": "1312564956",
    "formatted": "Aug 5, 2011, 5:22:36 PM UTC"
  },
  "modificationTime": {
    "timestamp": "1608567500",
    "formatted": "Dec 21, 2020, 4:18:20 PM UTC"
  },
  "photoTakenTime": {
    "timestamp": "1312564956",
    "formatted": "Aug 5, 2011, 5:22:36 PM UTC"
  },
  "geoData": {
    "latitude": 0.0,
    "longitude": 0.0,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
  },
  "geoDataExif": {
    "latitude": 0.0,
    "longitude": 0.0,
    "altitude": 0.0,
    "latitudeSpan": 0.0,
    "longitudeSpan": 0.0
  }
}


Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: RMcD on January 24, 2021, 03:27:32 PM
https://legault.me/post/correctly-migrate-away-from-google-photos-to-icloud

>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 <DirToProcess>

Found this which seems to do what you want.

I just want to confirm because I have a flat folder with my entire 1.6TB Google Archive. It would be annoying to have to redownload it if this breaks it. 200k images/videos, and 200k .json files.

I want to add/replace the EXIF information on the images with that from the json's when the name of the thing matches. My HDD is almost full so I need it to replace the image and not create a new one.

To be fair looking at the list I haven't seen a single date taken wrong
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: shauryainks on April 17, 2021, 03:13:35 PM
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
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: shauryainks on May 11, 2021, 02:11:00 PM
i am not able to do it plz help
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on May 11, 2021, 03:39:48 PM
You don't give us anything that we can use to help you.  What command did you try?  What was the output?
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: George.e on June 21, 2021, 06:33:29 AM
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).
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on June 21, 2021, 07:53:20 AM
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
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Kestouf on June 26, 2021, 06:14:53 AM
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
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on June 26, 2021, 10:14:44 AM
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.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Kestouf on June 26, 2021, 10:20:40 AM
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.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: raring_ringtail on November 13, 2021, 09:24:33 AM
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?
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on November 13, 2021, 10:12:41 AM
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 (https://github.com/exiftool/exiftool/tree/master/arg_files).  I don't think anyone has yet made an argfile to convert from Google takeout JSON tags.

- Phil
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on November 13, 2021, 10:37:45 AM
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.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on November 13, 2021, 10:42:48 AM
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 (https://exiftool.org/faq.html#Q5) (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.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: sammartin on January 02, 2022, 05:50:49 AM
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

Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: dt2022 on March 14, 2022, 02:05:10 PM
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
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on March 14, 2022, 02:37:26 PM
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.
Title: Re: How to merge image with his .json file
Post by: lahratla on June 22, 2022, 03:54:56 PM
Quote from: Nick_0278 on April 16, 2020, 01:45:12 AM
Thanks StarGeek, you're right. I don't understand why Google is giving you all the JSON files again. This was also the reason why I thought they were separate.

Nevertheless, I really thank you for your helpfulness.

So, that this thread can still be useful for someone, is that the result:
(If you've got also a Googlephotos export you do not need to do anything!)

To search only in the given directory for images and merge them with their json files:

exiftool -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s xy/

-Where xy/ must be replaced with your directory

To search also in Subfolder(s) of the given directory for images, and them merge them:

exiftool -r -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s xy/

- Where xy/ must be replaced with your directory
- the -r stands for recursively

EDIT:
should I somehow mark the thread as solved?

- Nicko


I followed this method and copy-pasted the command line on CMD, but got "The system cannot find the file specified." Please help.

exiftool -r -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s xy/ E:\Pictures\GPhotos\GPhotos\Mine\Takeout\Google Photos\Photos from 2013\
Title: Re: How to merge image with his .json file
Post by: StarGeek on June 22, 2022, 08:50:35 PM
Quote from: lahratla on June 22, 2022, 03:54:56 PM
I followed this method and copy-pasted the command line on CMD, but got "The system cannot find the file specified." Please help.

You have spaces in the file path.  Any parameter that has spaces in it must be quoted.  I dropped the slash from the end as it would escape the double quote and cause more problems.
"E:\Pictures\GPhotos\GPhotos\Mine\Takeout\Google Photos\Photos from 2013"
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: LemonFury on November 28, 2022, 04:53:35 PM
Hello.
I followed all instructions given by Phill Harvey in his first post in this conversation.
When I run the given command in the desired DIR, I get 2 errors about 2 json files that for some reason could not be opened and a message "1 directories scanned 349 image files updated 2 image files unchanged".
The main problem is that nothing changes (no date and gps info changes) in the initial JPG files in the folder but there are JPG_ORIGINAL files created for each JPEG.
If I use George.e 's method, I get no extra JPG_ORIGINAL files, i get the message "1 directories scanned 363 image files updated 2 image files unchanged" but in file properties dates are still the date that I downloaded them from Google Takeout.

Thank you for any tips provided.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 06, 2023, 01:40:22 PM
Hi,
I've read through all posts in this topic & made an attempt at running the script with the Win executable zip package. The output I get is as follows:

"C:\Downloads\exiftool-12.55>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 "C:\Downloads\Takeout\"
    1 directories scanned
    0 image files read

C:\Downloads\exiftool-12.55>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 "C:\Downloads\Takeout\Google Photos\"
    1 directories scanned
    0 image files read"

Takeout is the unzipped folder downloaded from Google Takeout & "Google Photos" is the immediate sub folder which contains the google photos albums in further subfolders.

Thanking you in anticipation of your advice.
R
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on February 06, 2023, 01:47:01 PM
Just try this to see what files ExifTool finds:

exiftool -filename -r "C:\Downloads\Takeout\Google Photos\"

Then try this:

dir "C:\Downloads\Takeout\Google Photos\"

and report back what you see.

- Phil
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 06, 2023, 02:56:47 PM
Thank you very much for your swift response Phil. The outpout from the two commands above is as follows:

C:\Downloads\exiftool-12.55>exiftool -filename -r "C:\Downloads\Takeout\Google Photos\"
    1 directories scanned
    0 image files read

C:\Downloads\exiftool-12.55>dir "C:\Downloads\Takeout\Google Photos\"
 Volume in drive C is OS
 Volume Serial Number is 20EC-C40F

 Directory of C:\Downloads\Takeout\Google Photos

06/02/2023  15:32    <DIR>          .
06/02/2023  15:32    <DIR>          ..
06/02/2023  15:31    <DIR>          1 year ago
06/02/2023  15:31    <DIR>          1-2 North Main Street, Youghal
06/02/2023  15:32    <DIR>          10SouthAbbey
06/02/2023  15:31    <DIR>          12 years since___
06/02/2023  15:32    <DIR>          12FrancisStreet
06/02/2023  15:32    <DIR>          20210110CatherinePkWalk
06/02/2023  15:32    <DIR>          20211106-Kush_s 1st Birthday celebration
06/02/2023  15:31    <DIR>          20211107-Arleen_s 4th Birthday @ Cinnamon Garden
06/02/2023  15:31    <DIR>          20211218Saturday Night @ Sheikhs_
06/02/2023  15:31    <DIR>          20211224-Christmas Eve@ Pitalias_
06/02/2023  15:31    <DIR>          20211225- Christmas @ Gognas_
06/02/2023  15:32    <DIR>          20211225- Christmas @ Sheikhs_
06/02/2023  15:32    <DIR>          20220205-Dosa Outing _ Dinner with Rashi_Ashutosh
06/02/2023  15:31    <DIR>          20220211- Jains, Agarwals, Sheikhs _ Singhs
               0 File(s)              0 bytes
              16 Dir(s)  22,858,489,856 bytes free

Await your further advice.

Kind regards
R
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on February 06, 2023, 03:56:02 PM
That is a mystery.  I can't imagine how that can happen.  It seems as if the subdirectories exist but aren't visible to ExifTool for some reason.

Can any Windows person here suggest how this might happen?

- Phil
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 06, 2023, 04:02:55 PM
While I was really hoping for the solution. You finding the issue a mystery makes me feel a little less dumb...

I appreciate your response and hope someone else will be able to advise further soon.

Thank you very much.
R
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on February 08, 2023, 06:58:23 AM
@StarGeek: Any idea how this could happen?

- Phil
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on February 09, 2023, 03:48:27 PM
Ah, got it.  The trailing backslash means that the last double quote is escaped.  Which means that exiftool is receiving
C:\Downloads\Takeout\Google Photos"
as the directory name.

Either remove the slash
"C:\Downloads\Takeout\Google Photos"

or double it
C:\Downloads\Takeout\Google Photos\\"

Or switch to forward slashes, either all or just the last one
C:\Downloads\Takeout\Google Photos/"

I remember this has come up before, but can't find the thread atm.
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on February 09, 2023, 03:49:59 PM
@StarGeek:  Excellent sleuthing!!!

I find it surprising and somewhat disconcerting that the command-line arguments are parsed differently for different commands ("exiftool" vs. "dir). :(

- Phil

Edit: Hmmm.  But now I don't understand why ExifTool would report that 1 directory was scanned.  :-\
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on February 09, 2023, 04:14:09 PM
I also forget that I have script that automatically avoids the problem. One program I regularly use always passes the directory to the clipboard with the trailing slash.  I have an autohotkey script (or maybe it's autoit) which takes care of it.

Finally found the previous case (https://exiftool.org/forum/index.php?topic=6655.msg33309#msg33309) of the trailing slash.  It was only 7½ years ago :)
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on February 09, 2023, 09:19:38 PM
Quote from: StarGeek on February 09, 2023, 04:14:09 PMIt was only 7½ years ago :)

There must have been more recent cases too because I had a recollection of this once you mentioned it and my memory isn't that good. :P

- Phil
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 10, 2023, 05:50:09 AM
Thank you very much Phil & StarGeek for your advice.

Appending a "\" did the trick. The result this time was as follows:

 15 directories scanned
 1003 image files updated
   42 image files unchanged

I shall now embark on the large scale editing. I shall now try re-uploading these on Google Photos to see if the edits are picked up in that app as desired.

Many thanks once again.

Kind regards
R
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 12, 2023, 05:37:08 AM
Hi Phil & StarGeek,

The changed command is now working. However, I've run into an issue having edited & uploaded the first 30GB (off a 1.7TB photo/ video collection exported from two separate Google Photos collections) to a single new Google Photos a/c.

I am unable to download the whole directory backup due to lack of SSD space. So, I'm doing this batches of 4GB.

Many images are now showing in the new Google Photos A/c with the correct date but getting sorted with a wrong date. For example - a file with the correct date of 20130324 file named (20130324_171440-MIX) is getting picked up with a date of 17/06/2013. I manually edited the date on Google photos so it is now showing in the correct date album on that application. I then downloaded a copy & it is still reading a creation date of 17/06/2013. This is a pattern observed in many cases.

It is highly likely that the images were manually sorted into those google photos albums (actually in Google Picasa even before Google photos was launched) and while they showed correctly in Google Photos in one account, the edited dates did not get saved to the actual file, which is what we needed this script to extract from the json tags.

The other possibility is that these were images received from WhatsApp or older cameras without the correct creation date.

So, I would be obliged for any ideas on how this problem can be surmounted. As In, if there is a date exported album from Google photos (in a date folder), is it possible to ensure that the file's time taken tag is matched with it?

Manually checking, downloading, fixing, reuploading the images is an extremely daunting exercise that I would like to avoid but would still do if the results are permanent.

Is there less a cumbersome way whereby I might be able to compare the file name & the time taken tag in bulk and edit them?

For images that don't contain the correct taken date in the file name, I guess it will have to a manual exercise, on a one by one basis, or have you any ideas how I might be able to do that in bulk as well.

All advice welcome.

Thanking you
R
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: StarGeek on February 15, 2023, 10:21:01 AM
Quote from: u81 on February 12, 2023, 05:37:08 AMI manually edited the date on Google photos so it is now showing in the correct date album on that application.

This is pretty much the only time that you actually want to copy data from the Google json files into the original.  I've screamed into the void that Google is not removing the metadata from files too many times and I've pretty much given up on dealing with Google Photo questions.

Quote from: u81 on February 12, 2023, 05:37:08 AMAs In, if there is a date exported album from Google photos (in a date folder), is it possible to ensure that the file's time taken tag is matched with it?

This is listed in a several times earlier in this thread.  But I think a better answer would be to make sure you don't overwrite any tags that already exist.  So I would suggest this as a more complete answer
exiftool -wm cg -d %s -tagsfromfile %d%f.%e.json "-AllDates<PhotoTakenTimeTimestamp" /path/to/files/

This will the date from the json file into the three most common date tags, DateTimeOriginal, CreateDate, and ModifyDate, but -wm (-writeMode) option (https://exiftool.org/exiftool_pod.html#wm-MODE--writeMode) will make sure that if the time data already exists, it will not be overwritten.  Because the "PhotoTakenTimeTimestamp" is a unix time stamp, the -d %s is needed to convert it properly.

It is important to note that the "PhotoTakenTimeTimestamp" value is in UTC and because of that, the date/time will be off by the time zone.  There really isn't an easy way to figure that out, as that data wasn't saved with the upload.

You might follow it up with this command to set the file system time stamps.  It can't be combined with the above command due to the -wm option.
exiftool -wm cg -d %s -tagsfromfile %d%f.%e.json "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" /path/to/files/
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 18, 2023, 08:07:39 AM
@StarGeek - Thank you very much for taking the time to address my query.

I did indeed read all of the posts in this thread and took on board that photos from WhatsApp etc. that did not have the correct "PhotoTakenTimeFormatted" in the file's metadata are the only ones that need to be modified.

However, I consciously chose to run the following command hoping that the JSON may contain some relevant data to add the correct date, given that only a small proportion of the files had a JSON file to match, hinting that those are the ones that I modified in the Google Picasa/ photos album.

Please excuse me if I didn't convey the issue properly.

I shall attempt to run the commands on your last post and revert with results.

I shall also read up Q5 of FAQ to see if I can comprehend it, given my very limited understanding or file structures, nomenclature, tags, EXIF etc.

Thank you once again for your patient help & guidance.

Kind regards
Raman
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: u81 on February 18, 2023, 02:31:17 PM
Hi @StarGeek,

I'm pleased to confirm that your last two commands seem to have done the job. I've posted hereunder the output received by doing the following actions:


The questions I have now are as follows:

I'm lucky that I live in GMT or BST zone so I think my time stamps taken at home should be almost in the correct dates - only those taken while I've been travelling may be out of sync. I can see how this may be problem for others though.

Many thanks once again to @Phil, @StarGeek & the members on this thread, most of whom have helped me with their posts- @Nick_0278, @h_correia, @George.e

D:\Downloads\exiftool-12.56>D:\Downloads\exiftool-12.56\exiftool.exeD:\Downloads\exiftool-12.56\IMG-20190413-WA0028.jpg.json
The filename, directory name, or volume label syntax is incorrect.

D:\Downloads\exiftool-12.56>D:\Downloads\exiftool-12.56\exiftool.exe D:\Downloads\exiftool-12.56\IMG-20190413-WA0028.jpg.json
ExifTool Version Number         : 12.56
File Name                       : IMG-20190413-WA0028.jpg.json
Directory                       : D:/Downloads/exiftool-12.56
File Size                       : 977 bytes
File Modification Date/Time     : 2023:02:10 06:32:10+00:00
File Access Date/Time           : 2023:02:18 18:12:41+00:00
File Creation Date/Time         : 2023:02:18 18:12:41+00:00
File Permissions                : -rw-rw-rw-
File Type                       : JSON
File Type Extension             : json
MIME Type                       : application/json
Creation Time Formatted         : 22 Apr 2019, 09:57:16 UTC
Creation Time Timestamp         : 1555927036
Description                     :
Geo Data Altitude               : 0.0
Geo Data Latitude               : 0.0
Geo Data Latitude Span          : 0.0
Geo Data Longitude              : 0.0
Geo Data Longitude Span         : 0.0
Geo Data Exif Altitude          : 0.0
Geo Data Exif Latitude          : 0.0
Geo Data Exif Latitude Span     : 0.0
Geo Data Exif Longitude         : 0.0
Geo Data Exif Longitude Span    : 0.0
Google Photos Origin Mobile Upload Device Folder Local Folder Name:
Google Photos Origin Mobile Upload Device Type: ANDROID_PHONE
Image Views                     : 1
Photo Last Modified Time Formatted: 27 Jan 2023, 12:16:14 UTC
Photo Last Modified Time Timestamp: 1674821774
Photo Taken Time Formatted      : 13 Apr 2019, 19:06:14 UTC
Photo Taken Time Timestamp      : 1555182374
Title                           : IMG-20190413-WA0028.jpg
Url                             : https://lh3.googleusercontent.com/BFjbtdnDysF-gBb7MT21ak-KgW_FPUuB02T0hHeCD3gBGGQBjrFqnnIB0cnlyeikM9HU1h71bxDsHcXlPEni4PDjkFVYlc5EpA4Q8gYT

D:\Downloads\exiftool-12.56>
D:\Downloads\exiftool-12.56>D:\Downloads\exiftool-12.56\exiftool.exe D:\Downloads\exiftool-12.56\IMG-20190413-WA0028.jpg
ExifTool Version Number         : 12.56
File Name                       : IMG-20190413-WA0028.jpg
Directory                       : D:/Downloads/exiftool-12.56
File Size                       : 206 kB
File Modification Date/Time     : 2023:02:10 06:32:10+00:00
File Access Date/Time           : 2023:02:18 18:16:13+00:00
File Creation Date/Time         : 2023:02:18 18:12:41+00:00
File Permissions                : -rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Little-endian (Intel, II)
Software                        : Picasa
Exif Version                    : 0220
Color Space                     : sRGB
Exif Image Width                : 1200
Exif Image Height               : 1600
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Image Unique ID                 : 2d385b4498db1edb0000000000000000
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 324
Thumbnail Length                : 7681
XMP Toolkit                     : XMP Core 5.5.0
Current IPTC Digest             : b443520a10119da99c2550175e6d0efb
Envelope Record Version         : 4
Coded Character Set             : UTF8
Application Record Version      : 4
IPTC Digest                     : b443520a10119da99c2550175e6d0efb
Image Width                     : 1200
Image Height                    : 1600
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1200x1600
Megapixels                      : 1.9
Thumbnail Image                 : (Binary data 7681 bytes, use -b option to extract)

D:\Downloads\exiftool-12.56>exiftool -wm cg -d %s -tagsfromfile %d%f.%e.json "-AllDates<PhotoTakenTimeTimestamp" D:\Downloads\exiftool-12.56\Test
    1 directories scanned
    1 image files updated

D:\Downloads\exiftool-12.56>D:\Downloads\exiftool-12.56\exiftool.exe D:\Downloads\exiftool-12.56\Test\IMG-20190413-WA0028.jpg
ExifTool Version Number         : 12.56
File Name                       : IMG-20190413-WA0028.jpg
Directory                       : D:/Downloads/exiftool-12.56/Test
File Size                       : 206 kB
File Modification Date/Time     : 2023:02:18 18:17:51+00:00
File Access Date/Time           : 2023:02:18 18:18:20+00:00
File Creation Date/Time         : 2023:02:18 18:16:01+00:00
File Permissions                : -rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Little-endian (Intel, II)
Software                        : Picasa
Modify Date                     : 2019:04:13 19:06:14
Exif Version                    : 0220
Date/Time Original              : 2019:04:13 19:06:14
Create Date                     : 2019:04:13 19:06:14
Color Space                     : sRGB
Exif Image Width                : 1200
Exif Image Height               : 1600
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Image Unique ID                 : 2d385b4498db1edb0000000000000000
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 420
Thumbnail Length                : 7681
XMP Toolkit                     : XMP Core 5.5.0
Current IPTC Digest             : b443520a10119da99c2550175e6d0efb
Envelope Record Version         : 4
Coded Character Set             : UTF8
Application Record Version      : 4
IPTC Digest                     : b443520a10119da99c2550175e6d0efb
Image Width                     : 1200
Image Height                    : 1600
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1200x1600
Megapixels                      : 1.9
Thumbnail Image                 : (Binary data 7681 bytes, use -b option to extract)

D:\Downloads\exiftool-12.56>exiftool -wm cg -d %s -tagsfromfile %d%f.%e.json "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" D:\Downloads\exiftool-12.56\Test\IMG-20190413-WA0028.jpg
    0 image files updated
    1 image files unchanged

D:\Downloads\exiftool-12.56>D:\Downloads\exiftool-12.56\exiftool.exe D:\Downloads\exiftool-12.56\Test\IMG-20190413-WA0028.jpg
ExifTool Version Number         : 12.56
File Name                       : IMG-20190413-WA0028.jpg
Directory                       : D:/Downloads/exiftool-12.56/Test
File Size                       : 206 kB
File Modification Date/Time     : 2023:02:18 18:17:51+00:00
File Access Date/Time           : 2023:02:18 18:21:40+00:00
File Creation Date/Time         : 2023:02:18 18:16:01+00:00
File Permissions                : -rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Little-endian (Intel, II)
Software                        : Picasa
Modify Date                     : 2019:04:13 19:06:14
Exif Version                    : 0220
Date/Time Original              : 2019:04:13 19:06:14
Create Date                     : 2019:04:13 19:06:14
Color Space                     : sRGB
Exif Image Width                : 1200
Exif Image Height               : 1600
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Image Unique ID                 : 2d385b4498db1edb0000000000000000
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 420
Thumbnail Length                : 7681
XMP Toolkit                     : XMP Core 5.5.0
Current IPTC Digest             : b443520a10119da99c2550175e6d0efb
Envelope Record Version         : 4
Coded Character Set             : UTF8
Application Record Version      : 4
IPTC Digest                     : b443520a10119da99c2550175e6d0efb
Image Width                     : 1200
Image Height                    : 1600
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1200x1600
Megapixels                      : 1.9
Thumbnail Image                 : (Binary data 7681 bytes, use -b option to extract)

D:\Downloads\exiftool-12.56>exiftool cg -d %s -tagsfromfile %d%f.%e.json "-FileCreateDate<PhotoTakenTimeTimestamp" "-FileModifyDate<PhotoTakenTimeTimestamp" D:\Downloads\exiftool-12.56\Test\IMG-20190413-WA0028.jpg
Warning: Error opening file - cg..json
Error: File not found - cg
    1 image files updated
    1 files weren't updated due to errors

D:\Downloads\exiftool-12.56>D:\Downloads\exiftool-12.56\exiftool.exe D:\Downloads\exiftool-12.56\Test\IMG-20190413-WA0028.jpg
ExifTool Version Number         : 12.56
File Name                       : IMG-20190413-WA0028.jpg
Directory                       : D:/Downloads/exiftool-12.56/Test
File Size                       : 206 kB
File Modification Date/Time     : 2019:04:13 19:06:14+01:00
File Access Date/Time           : 2023:02:18 18:24:16+00:00
File Creation Date/Time         : 2019:04:13 19:06:14+01:00
File Permissions                : -rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Little-endian (Intel, II)
Software                        : Picasa
Modify Date                     : 2019:04:13 19:06:14
Exif Version                    : 0220
Date/Time Original              : 2019:04:13 19:06:14
Create Date                     : 2019:04:13 19:06:14
Color Space                     : sRGB
Exif Image Width                : 1200
Exif Image Height               : 1600
Interoperability Index          : R98 - DCF basic file (sRGB)
Interoperability Version        : 0100
Image Unique ID                 : 2d385b4498db1edb0000000000000000
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 420
Thumbnail Length                : 7681
XMP Toolkit                     : XMP Core 5.5.0
Current IPTC Digest             : b443520a10119da99c2550175e6d0efb
Envelope Record Version         : 4
Coded Character Set             : UTF8
Application Record Version      : 4
IPTC Digest                     : b443520a10119da99c2550175e6d0efb
Image Width                     : 1200
Image Height                    : 1600
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
Image Size                      : 1200x1600
Megapixels                      : 1.9
Thumbnail Image                 : (Binary data 7681 bytes, use -b option to extract)
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Exifthroughthegiftshop on October 04, 2023, 10:52:23 AM
Hi folks,

another exiftool newb here - finding my way here like many others - the google photos takeout.

Sorry for grave digging in this old thread - though I feel so much has been discussed in here, that it's probably better to continue around here than opening a new one.

As I did some tagging and description additions in google photos, I'd loive to give it a try and bring that metadata info (and to be on the safe side the timestamp metadata) from the json files back with the respective images.


Found the comands provided here - yet I'm already failing to paste them on the exiftools.exe

Here's what I did:
- I downloaded the Windows executable and renamed it without the (k).

- I open the exiftools.exe - and all I'm seingis the long manual - it doesn't look ready to accept commands.
How can I paste the commands, what am I missing as a complete newbie?

Thanks a lot!
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: puc0 on January 03, 2024, 11:55:27 AM
Hello to all.
I am one of those "second time in life opening terminal" people.
As all above me, I'm trying to match metadata from json files to my jpegs that came with google photos takeout. I used the script below from Nick:

Quote from: Nick_0278 on April 16, 2020, 01:45:12 AMTo search also in Subfolder(s) of the given directory for images, and them merge them:

exiftool -r -ext jpg -tagsfromfile %d%f.%e.json -description '-gpslatitude<geodatalatitude' '-gpslatituderef<geodatalatitude' '-gpslongitude<geodatalongitude' '-gpslongituderef<geodatalongitude' '-gpsaltitude<geodataaltitude' '-createdate<creationdatetimestamp' '-datetimeoriginal<phototakentimetimestamp' '-modifydate<modificationtimetimestamp' -d %s xy/

- Where xy/ must be replaced with your directory
- the -r stands for recursively

EDIT:
should I somehow mark the thread as solved?
- Nicko

But without major success.
First of all, not all jpeg files have their .json twin, so I guess that files are just left behind.
The folders do get scanned, but the result is that less then half of the files are changed, videos are not touched (but thats a problem to solve after the photos) and even on the changed files the created date shows when the file was extracted, not when it was really created.
I'm running macOs Catalina on and old macbook pro from 2012.

Can somebody help me out?
PS. I know that this goes against the idea of this tool, but I would gladly pay for a software to fix this issue, but unfortunately they don't work either. The "google photos metadata fixer" does not fix anything and another two I've tried  also did not solve the problem. Is there any proven solution? I mean the whole reason I went with google was to be hustle free, and now I've already spent a whole day trying to escape the platform.

Thank you.

The result:  3 directories scanned
   51 image files updated
   84 image files unchanged
   51 files weren't updated due to errors

(https://i.ibb.co/TYB0wK5/Screenshot-2024-01-03-at-17-53-52.png) (https://ibb.co/vVxdcs8)
Title: Re: How to merge image with his .json file (Google Photos takeout)
Post by: Phil Harvey on January 03, 2024, 12:27:17 PM
Quote from: puc0 on January 03, 2024, 11:55:27 AMvideos are not touched

The command specifies -ext jpg so only JPG files will be processed.  Add more -ext option to also process other file types.

Unprocessed files either had missing JSON files, or JSON files with slightly different naming, or JSON files which didn't contain any of the tags you are trying to copy.

- Phil