Author Topic: datetimeoriginal - batch edit using Exiftool for macOS  (Read 2710 times)

prettypixel

  • Jr. Member
  • **
  • Posts: 13
datetimeoriginal - batch edit using Exiftool for macOS
« on: March 29, 2018, 08:12:59 AM »
I have been using the following command to edit the datetimeoriginal tag:

exiftool ‘-datetimeoriginal=2018:02:26 12:00:00’ apple.jpg

I would now like to be able to batch edit this tag of all files in a given directory. I would like to keep the same date for all files, but if possible move the time on a minute for each file in the directory. Can this be done? If so, what command do I need to run?

Thank you in advance.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #1 on: March 29, 2018, 08:45:58 AM »
This can be done in 2 steps.

1. exiftool "-datetimeoriginal=2018:02:26 12:00:00" DIR

2. exiftool '-datetimeoriginal+<0:$filesequence' DIR

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

prettypixel

  • Jr. Member
  • **
  • Posts: 13
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #2 on: March 29, 2018, 10:28:09 AM »
Phil - Many thanks  :)

UPDATE: I ran the commands to batch edit all files in one directory. I just had one issue, the directory contains both .jpg and .png files. The .jpg files now appear in the macOS Photos 'Moments' timeline showing the correct date and time. However, the .png files display the incorrect date and time in the app.

I have viewed the .png files metadata using Exiftool, and the datetimeoriginal tags are correct. I would like to understand what the issue is with the .png files not displaying correctly in the macOS Photos app.

Many thanks.
« Last Edit: March 29, 2018, 02:31:01 PM by prettypixel »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #3 on: March 29, 2018, 09:17:48 PM »
For PNG you should probably write a native PNG tag.  I don't know what metadata Photos looks for, but you could try writing all available PNG date/time tags with different values to see which one takes:

CreateDate
ModifyDate
ModDate
CreationTime

Report back here if you can determine which one to use.

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

prettypixel

  • Jr. Member
  • **
  • Posts: 13
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #4 on: March 30, 2018, 09:42:24 AM »
Many thanks Phil. I followed your advice:

1. Removal of all metadata from PNGs
2. Experimented by the following tags, with different values:
    * CreateDate
    * ModifyDate
    * ModDate
    * CreationTime
3. Imported the PNGs to macOS Photos app. Date/time information still incorrect on the ‘Moments’ timeline view. Then, after comparing the macOS Photos date/time information and Exiftool metadata retrieval for each PNG, I realised that macOS Photos must use either:
    * File Modification Date/Time tag
    * File Access Date/Time tag
    * File Incode Change Date/Time tag

I know this, because the date/time values of the three tags as shown by Exiftool, were the same in the macOS Photos ‘Moments’ timeline.

So, I started over:

1. Removal of all existing metadata from all files, JPG and PNG
2. GPS tags: exiftool -exif:gpslatitude=“53.319507” -exif:gpslatituderef=N -exif:gpslongitude=“-0.666974” -exif:gpslongituderef=W DIR
3. datetimeoriginal tag: exiftool ‘-datetimeoriginal=2018:01:01 12:00:00’ DIR
4. One minute increments to datetimeoriginal tag: exiftool '-datetimeoriginal+<0:$filesequence’ DIR
5. PNG only: filemodifydate tag: making sure this tag contained exactly the same values as the datetimeoriginal tag: exiftool ‘-filemodifydate=2018:01:01 12:45:00’ filename.png
6. Import all images to macOS Photos app
7. All images, JPG and PNG now display the correct date/time information in the app

Does this sound like a reasonable workflow? Many thanks again.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #5 on: March 30, 2018, 03:55:08 PM »
Sure, sounds good, except that I would write PNG:CreateDate to PNG's instead of EXIF:DateTimeOriginal if you want to be as compatible as possible with other apps (since basically nothing but ExifTool will support EXIF in PNG images -- this was a fairly recent addition to the specification).  But since you are writing EXIF GPS tags also, you might as well continue to write EXIF:DateTimeOriginal, but maybe just add PNG:CreateDate to the command to write both if the file is PNG.

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

prettypixel

  • Jr. Member
  • **
  • Posts: 13
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #6 on: April 01, 2018, 04:33:35 AM »
Hi Phil

Thank you for the advice.

Further to my previous reply - where I detailed my workflow, I found that, when I uploaded my PNG's to macOS Photos app and Google Photos, the GPS tags were not present. So, I decided to start over and convert PNG's to JPG's, then add date/time and GPS tags using Exiftool, and import to macOS Photos and Google Photos. All good.

Following your suggestion, I added the CreateDate tag to a PNG file to test out the results. Unfortunately, when the file was imported to macOS Photos and Google Photos, this info was not present and the date/time was incorrect.

It would seem that JPG files are the best file format to use, if GPS, date/time metadata, etc is important when using apps such as macOS Photos and Google Photos?

Thanks again  :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #7 on: April 02, 2018, 07:19:58 AM »
Yes.  Unfortunately PNG metadata support by other applications is very poor.

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

Alan Clifford

  • ExifTool Freak
  • *****
  • Posts: 609
    • A selection of Alan Clifford's photographs
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #8 on: April 02, 2018, 08:39:39 AM »
It's probably too soon to change to HEIC format but I've read that Google Photos supports it as well as MacOS on High Sierra.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: datetimeoriginal - batch edit using Exiftool for macOS
« Reply #9 on: April 02, 2018, 09:16:37 AM »
I would not recommend HEIC.  This is a very complex format that will take some time before it is supported by a wide range of applications (if ever).

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