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

StarGeek

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 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/
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

u81

@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

u81

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:

  • Used Exiftool command to check the tags in the JSON file downloaded with a WhatsApp image that came from Google Takeout - it contains the "Photo Taken Time Formatted" & "Photo Taken Time Timestamp" information
  • Used Exiftool command to check the tags in a WhatsApp image download using Google Takeout - it is missing "Modify Date", "Date/Time Original" & "Create Date" information
  • Ran the first command advised by you which added the 3 dates missing at step 2
  • Ran the second command advised by you which did not update anything to the file as it the file already contains "File Modification Date/Time", "File Access Date/Time" & "File Creation Date/Time" - taken from when the file was downloaded using Google Takeout
  • I then re-ran your second command without the -wm, which gave and error about "cg" but it did modify "File Modification Date/Time" & "File Creation Date/Time" fields so my computer's file system now shows that date also and will get almost software to sort the files in correct date sorted albums (on local disk), in most cases

The questions I have now are as follows:
  • Have I read the output from the code below correctly?
  • Did you mean to have the -wm option in the second command?
  • What does the "cg" after -wm do?
  • Am I correct in understanding that running these two commands on the whole library would still only alter the files that have a corresponding JSON (even the second command with or without -wm cg)?
  • Do you see any problems with me changing the local filesystem timestamps with the values from the UTC saved in the JSON?
  • Is the "Photo Taken Time Formatted" just what is says, that is a formatted display value based on the "Photo Take Time Timestamp" field?
  • Any other suggestions on what else can/ should be done when reorganising a 1.7 TB photo library

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)

Exifthroughthegiftshop

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!

puc0

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


Phil Harvey

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