Google Takeout & Exiftool - Not setting the creationdate and modifydate for gif

Started by balajiit, February 08, 2021, 01:18:12 AM

Previous topic - Next topic

balajiit

Hello,

First and foremost thanks a lot for this wonderful tool and support.

I'm using Google Takeout to download the albums from Google Photos. The unzipped folder contains all the image files (jpeg and gif) along with the metadata in .json files. As a common use case, I'm trying to update the FileCreationDate and FileModificationDate on the images using the metadata from the json files. I'm able to update the jpeg files but not the gif files even though the .json for the gif files contains the creation date and modify date timestamps.

I'm using Mac and my ExifTool version is 12.14.

These are the commands that I'm using from Terminal.
$exiftool '-TagsFromFile' %d/%F.json -ext gif -ext jpeg -ext jpg <source directory> -o <destination directory>/
Warning: No writable tags set from <target directory>/IMG_3204-MOTION.gif
Warning: No writable tags set from <target directory>/IMG_3231-MOTION.gif
Warning: No writable tags set from <target directory>/IMG_3141-MOTION.gif
Warning: No writable tags set from <target directory>/IMG_3120-MOTION.gif
Warning: No writable tags set from <target directory>/IMG_3166-MOTION.gif
Warning: No writable tags set from <target directory>/IMG_3279-MOTION.gif
Warning: No writable tags set from <target directory>/IMG_3216-MOTION.gif
    1 directories scanned
    1 directories created
  214 image files created
    7 image files copied

$exiftool -time:all -a -G0:1 -s IMG_3216-MOTION.gif
[File:System]   FileModifyDate                  : 2021:02:07 21:43:01-08:00
[File:System]   FileAccessDate                  : 2021:02:07 21:43:02-08:00
[File:System]   FileInodeChangeDate             : 2021:02:07 21:43:01-08:00

When I checked the contents of the gif.json file, I can see the timestamp there.
$more IMG_3216-MOTION.gif.json
{
  "title": "IMG_3216-MOTION.gif",
  "description": "",
  "imageViews": "0",
  "creationTime": {
    "timestamp": "1372459975",
    "formatted": "Jun 28, 2013, 10:52:55 PM UTC"
  },
  "modificationTime": {
    "timestamp": "1609456709",
    "formatted": "Dec 31, 2020, 11:18:29 PM UTC"
  },
  "photoTakenTime": {
    "timestamp": "1369972261",
    "formatted": "May 31, 2013, 3:51:01 AM 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
  },
  "googlePhotosOrigin": {
    "composition": {
      "type": "AUTO"
    }
  }
}

What am I missing here?

Kindly suggest.

Phil Harvey

Try this:

exiftool -tagsfromfile %d%F.json '-filemodifydate<modificationtimetimestamp' '-filecreatedate<creationtimetimestamp' -d %s -ext gif -ext jpg DIR

There are lots of other posts about this.  Here is one.

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

balajiit

Phil: Thank you for the pointer. I'm able to make it work. This is what I did.

1) Ran the syntax that you provided but it error'ed it out saying "Warning: Error 256 running "setfile" to set FileCreateDate".
2) Using the link that you provided, I installed the tools required without installing the complete Xcode.
3) Instead of using the creation date timestamp, I used photo taken timestamp which provided the actual time the picture was taken.
3) This is the final syntax:
exiftool -tagsfromfile %d/%F.json '-filemodifydate<modificationtimetimestamp' '-MDItemFSCreationDate<phototakentimetimestamp' -d %s -ext gif -ext jpg <sourcefolder> -o <destinationfolder>/

I have one final question:
Each Google takeout album has metadata.json file. This is how it looks like:
$more metadata.json
{
  "albumData": {
    "title": "<albumname>",
    "description": "",
    "access": "protected",
    "date": {
      "timestamp": "1369970588",
      "formatted": "May 31, 2013, 3:23:08 AM UTC"
    },
    "location": "",
    "geoData": {
      "latitude": 0.0,
      "longitude": 0.0,
      "altitude": 0.0,
      "latitudeSpan": 0.0,
      "longitudeSpan": 0.0
    }
  }
}

If you look at my syntax, I'm specifying the target directory. I want to create the directory name prepended with the date timestamp from the metadata.json along with the title attribute from the metadata.json. For e.g. It will be yyyymmdd_<title>

Can you please suggest?

Phil Harvey

Try this:

exiftool -tagsfromfile %d/%F.json '-filemodifydate<modificationtimetimestamp' '-MDItemFSCreationDate<phototakentimetimestamp' -d %s -ext gif -ext jpg <sourcefolder> -o . '-directory<DESTINATIONFOLDER/${phototaketimestamp;$_=ConvertUnixTime($_);DateFmt("%Y%m%d")}_$title'

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

balajiit

Phil:

In my case, the source directory contains 221 image files and 221 .json files in addition to the metadata.json which is the metadata file for the entire directory.

When I issue the command like this,
exiftool -tagsfromfile %d/%F.json '-filemodifydate<modificationtimetimestamp' '-MDItemFSCreationDate<phototakentimetimestamp' -d %s -ext gif -ext jpg <sourcedirectory> -o . '-directory<${phototakentimetimestamp;$_=ConvertUnixTime($_);DateFmt("%Y%m%d")}_$title'

It creates 221 directories like 20130531_IMG_3292.JPG and inside the directory, the file IMG_3292.JPG is created.

What I want is only one directory called 20130531_<title from the album> needs to be created and all the 221 images goes under that folder. Of course, all the 221 images modify date, creationdate gets updated from the image.json file metadata.

It appears me it is two step process. First step, creates all the files with the correct date stamp. Second step, update the destination folder name with the syntax that mentioned.

Is it possible?

Phil Harvey

What is the value of "Title" for IMG_3292.JPG?  It seems that the title is "IMG_3292.JPG" since you say the directory created was "20130531_IMG_3292.JPG".  Maybe you want to use some tag other than "Title".

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