ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: lokatz on July 30, 2023, 05:57:43 PM

Title: Strange issue when writing to ExifIFD: DateTimeOriginal
Post by: lokatz on July 30, 2023, 05:57:43 PM
I'm seeing another issue where I cannot quite figure out what may be causing it.  Could not find anything in the FAQs, but I might have overlooked something.  (Wouldn't be the first time - my apologies if that's the case.)  Anyway, here's what is happening:

In order to implement the option to adjust an image's CreateDate info by X hours, I am parsing the file for all related tags and groups (ExifIFD:CreateDate, ExifIFD:DateTimeOriginal, XMP-xmp:CreateDate, XMP-photoshop:DateCreated, IPTC:DateCreated, IPTC:TimeCreated, Composite:DateTimeCreated), determine the "right" CreateDate, which is usually the oldest one, apply the offset, then write each tag I found, with its respective group, back to the image file.  An example looks like this: 

I initially read

[ExifIFD]       CreateDate                      : 2021:01:09 15:12:30

and want to go, say, an hour forward, so I write it back via

-overwrite_original -ExifIFD:CreateDate="2021:01:09 16:12:30" ...

This works well for most fields.  I realize that Composite:DateTimeCreated cannot be overwritten;  well, so be it.  However, I continually get the following issue:  Writing

-overwrite_original -ExifIFD:DateTimeOriginal="2021:01:09 16:12:30" ...

consistently results in the file's DateTimeOriginal thereafter appearing as

[ExifIFD]       DateTimeOriginal                : 2021:01:09 17:12:30

In other words, DateTimeOriginal is consistently set to ONE MORE hour forward than the write command asked Exiftool to do.  All group/tag commands are issued as one single ExifTool command, and in each case, I use an identical DateTime field.  There is no chance for me to accidentally be overlooking a one hour offset here, meaning I am positive that all related tags are shifted via the same command.  Yet, all but ExifIFD:DateTimeOriginal shift by one hour in my example case, whereas ExifIFD:DateTimeOriginal shifts by two.  This happens consistently with all kinds of image types (RAW, JPG, ...), and images from various camera makes.

Any ideas what might be causing this?
Title: Re: Strange issue when writing to ExifIFD: DateTimeOriginal
Post by: StarGeek on July 31, 2023, 12:03:09 AM
Quote from: lokatz on July 30, 2023, 05:57:43 PMThis works well for most fields.  I realize that Composite:DateTimeCreated cannot be overwritten;  well, so be it.  However, I continually get the following issue:  Writing

Composite tags (https://exiftool.org/TagNames/Composite.html) are not embedded tags.  They are created by exiftool on the fly from multiple other tags.  In this case, it is created by combining IPTC:DateCreated and IPTC:TimeCreated.

Some Composite tags can be written to and are often useful for writing multiple, connected tags at once.

QuoteAll group/tag commands are issued as one single ExifTool command, and in each case, I use an identical DateTime field.

What is the complete actual command you are using?

The snippet you list works correctly, so there must be something else going on.
C:\>exiftool -P -overwrite_original -DateTimeOriginal="2021:01:09 16:12:30" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -DateTimeOriginal y:\!temp\Test4.jpg
[ExifIFD]       DateTimeOriginal                : 2021:01:09 16:12:30
Title: Re: Strange issue when writing to ExifIFD: DateTimeOriginal
Post by: lokatz on July 31, 2023, 02:11:22 AM
Thanks for the hint regarding Composites.  Didn't realize that.


EDIT:  I just realized that the issue was caused by a piece of code in a different part, in fact, in a different file within my program, that I had overlooked. 

          My sincere apology for wasting your time!  (The Composites hint was nevertheless useful for me... - thanks!)