setting and ofsetting FileCreateDate at the same time

Started by DavidOB, July 20, 2016, 02:20:27 PM

Previous topic - Next topic

DavidOB

Hi,
I'm using this great exiftool for ages and for thousands of my photos, so far happily and nothing to complain  ;)
Now I tried to optimize launching it and found this behaviour I'm not sure is correct. It seems to me that if setting the file creation date (redirecting from the datetimeoriginal tag) and at the same time adjusting it by an offset, it takes the original file date ignoring the redirection and adjust it, however for file modify date it does both:
Original image:
exiftool -a -G1 -s -time:all "ORIGIMG.JPG"
[System]        FileModifyDate                  : 2016:07:13 15:15:27+02:00
[System]        FileAccessDate                  : 2016:07:20 19:32:54+02:00
[System]        FileCreateDate                  : 2016:07:20 19:32:50+02:00
[IFD0]          ModifyDate                      : 2016:07:13 15:15:27
[ExifIFD]       DateTimeOriginal                : 2016:07:13 15:15:27
[ExifIFD]       CreateDate                      : 2016:07:13 15:15:27

exiftool -a "-filename=newimg.jpg" "-filemodifydate<datetimeoriginal" "-filecreatedate<datetimeoriginal" "-AllDates-='1:00:00'" "-FileModifyDate-='1:00:00'" "-FileCreateDate-='1:00:00'" "ORIGIMG.JPG"
exiftool -a -G1 -s -time:all "newimg.jpg"

[System]        FileModifyDate                  : 2016:07:13 14:15:27+02:00
[System]        FileAccessDate                  : 2016:07:13 14:15:27+02:00
[System]        FileCreateDate                  : 2016:07:20 18:32:50+02:00
[IFD0]          ModifyDate                      : 2016:07:13 14:15:27
[ExifIFD]       DateTimeOriginal                : 2016:07:13 14:15:27
[ExifIFD]       CreateDate                      : 2016:07:13 14:15:27

Here, the FileCreateDate was decreased by one hour, but from the ORIGIMG.JPG file date. However, the filemodifydate is set to the datetimeoriginal and then decreased.

When I omit the "-FileCreateDate-='1:00:00'", the result is:
exiftool -a "-filename=newimg2.jpg" "-filemodifydate<datetimeoriginal" "-filecreatedate<datetimeoriginal" "-AllDates-='1:00:00'" "-FileModifyDate-='1:00:00'" "ORIGIMG.JPG"
exiftool -a -G1 -s -time:all "newimg2.jpg"
[System]        FileModifyDate                  : 2016:07:13 14:15:27+02:00
[System]        FileAccessDate                  : 2016:07:13 14:15:27+02:00
[System]        FileCreateDate                  : 2016:07:13 15:15:27+02:00
[IFD0]          ModifyDate                      : 2016:07:13 14:15:27
[ExifIFD]       DateTimeOriginal                : 2016:07:13 14:15:27
[ExifIFD]       CreateDate                      : 2016:07:13 14:15:27

which sets the file creation date to the datetimeoriginal timestamp.
My system is Windows 7 SP1 (64bit) + Exiftool 10.23.

Why is it different for FileCreateDate and FileModifyDate?

Phil Harvey

#1
Hi David,

The behaviour is straightforward:  Copying a tag or shifting a date/time tag always works from the original value in the file.  When you copy a tag then shift the same tag, the copy operation is overridden by the shift.  I think this explains everything you observed.

Quote from: DavidOB on July 20, 2016, 02:20:27 PM
Here, the FileCreateDate was decreased by one hour, but from the ORIGIMG.JPG file date. However, the filemodifydate is set to the datetimeoriginal and then decreased.

No it wasn't.  It was just decreased by one hour.

QuoteWhy is it different for FileCreateDate and FileModifyDate?

I don't think it is.

The solution is to use the -globalTimeShift option.  This problem is exactly why the option was created.  It shifts the extracted value of all date/time tags, allowing you to copy the shifted value to another tag.

- Phil

Edit: I have added this as FAQ 28.  Please let me know if you have any suggestions about improving this FAQ.  Thanks.
...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 ($).

DavidOB

Ah! I didn't see the possibility to globally shift everything. I think I thought it belongs to geotagging while reading the documentation. And I got also fooled and didn't see the original file date is already correct (some other images didn't have it so for whichever reason and I didn't notice this one is OK).

So the correct way should be like
exiftool -a "-FileName=newimg.jpg" "-FileModifyDate<DateTimeOriginal" "-FileCreateDate<DateTimeOriginal" "-AllDates<DateTimeOriginal" -GlobalTimeShift '-1:00:00'" "ORIGIMG.JPG"

Thanks!!!

As for the FAQ: Yes, this helps. It might be good also to mention the incorrect way (the one I did) and explain what does it do. Secondarily - just to make sure I understand it correctly - in general, all operations are done using the original source image tag values and there is no access to the newly created values? (and when needed, new run of exiftool would be necessary)

Phil Harvey

Quote from: DavidOB on July 21, 2016, 03:12:52 AM
just to make sure I understand it correctly - in general, all operations are done using the original source image tag values and there is no access to the newly created values? (and when needed, new run of exiftool would be necessary)

Correct.  I know this is documented somewhere, but since I can't find it easily right now it seems the documentation could be better.

I'll think about ways to improve this. Thanks for your suggestion about the FAQ, I have updated it accordingly.

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