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/
* 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).

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)