XMP-exif:DateTimeOriginal changed unexpectetly

Started by Mac2, January 16, 2025, 05:43:16 AM

Previous topic - Next topic

Mac2

I'm not sure how to explain this, let me know if you need more info.

A user updates the values of

XMP::xmp\CreateDate\CreateDate
XMP::photoshop\DateCreated\DateCreated

by changing the time-zone offset.
This also updates XMP::exif\DateTimeOriginal\DateTimeOriginal since it is linked to XMP::photoshop\DateCreated\DateCreated .

My software sends instructions via args file to ExifTool. All time stamps are written correctly and synchronized into to native EXIF by running the XMP2EXIF.args file. ExifTool also sets the correct EXIF time zone offsets:

[ExifIFD]      Offset Time Original            : -14:00
[ExifIFD]      Offset Time Digitized          : -14:00

Perfect result.

Now the user makes another change, for instance sets a rating. My software writes the change to the image. It only writes the rating and some XMP instance ids in the xmpMM namespace. Full args file and verbose output attached.

When my software re-imports the data afterwards, I notice that the XMP::exif\DateTimeOriginal\DateTimeOriginal timestamp has lost it's time zone offset.

Looking at the verbose ExifTool output, I see this:

- XMP-exif:DateTimeOriginal = '2024-11-23T06:55:45-11:00'
+ XMP-exif:DateTimeOriginal = '2024-11-23T06:55:45'

It removes the existing timestamp with time-zone offset and sets another (?) timestamp without a time-zone offset.
Why is that? Do I do something wrong?

I have attached the args file and verbose output below.


Phil Harvey

Right.  Here is the description of XMP-exif:DateTimeOriginal in the CIAP DC-010-2024 standard:

Date and time when the image was captured, stored in ISO 8601 format, not in the original Exif format. This property includes the value for the Exif SubSecTimeOriginal (37521, 0x9291) attribute.

No mention of OffsetTimeOriginal.

However, the description for OffsetTimeOriginal says this for the corresponding XMP property:

No mapping given (c)

c Mapping to XMP property is not given to this Exif tag field because the value of this tag field is mapped to an XMP property corresponding to a different Exif tag field.


So is seems they may have meant it to be mapped into XMP-exif:DateTimeOriginal.  (the JEITA/CIPA standards are really poorly thought out and badly written)

Currently, the exif2xmp.args file just takes XMP-exif:DateTimeOriginal from EXIF:DateTimeOriginal, so no time zone.  I'll update this to copy from Composite:SubSecDateTimeOriginal in the next release, and I think this should resolve your issue.

Note that exif2xmp.args maps Composite:SubSecDateTimeOriginal into XMP-photoshop:DateCreated, so the updated time zone will appear in this tag.

- Phil

Aside: I don't know what identifies tags using names like "XMP::exif\DateTimeOriginal\DateTimeOriginal", but I assume you mean "XMP-exif:DateTimeOriginal" in ExifTool parlance.

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

Mac2

Quote(the JEITA/CIPA standards are really poorly thought out and badly written)
I agree. Fuzzy and non-well defined standards are always a minefield for implementers and users.

I'm often at the receiving end of what I call metadata mess.
User finds issue, reports it to me, I try to reproduce it and figure out what the problem is (mostly caused by me).
Metadata is always a good area for all kinds of issues, especially if you deal with customers managing images in my DAM that have been created over 20 or 30 years and mangled with all kinds of software over the years.

ExifTool is a godsend for managing metadata and the gold standard (from my perspective). As always, thanks :) for it!

I encourage my users to stick with "Create Date" and "Date Subject Created", because these work very well across EXIF legacy IPTC and XMP thanks to ExifTool.

But I see sense in using and modifying XMP-exif:DateTimeOriginal in certain situations and it would be awesome if you can somehow manage to retain it unmodified. I don't know how complicated this is or how much work it generates. I thank you (and apologize up-front) for looking into this.

Phil Harvey

I will modify the xmp2exif.args and exif2xmp.args to handle time zones in the XMP-exif date/time tags, but there will always be issues due to the overlapping mappings:

EXIF:ModifyDate (TIFF DateTime) maps into XMP-xmp:ModifyDate (no problem here).

EXIF:CreateDate (CIPA DateTimeDigitized) maps into both XMP-xmp:CreateDate (historically and by the CIPA standard) and XMP-exif:DateTimeDigitized (duplicate mapping by the CIPA standard).

EXIF:DateTimeOriginal maps into XMP-photoshop:DateCreated (historically), and XMP-exif:DateTimeOriginal (according to CIPA spec).

Going from EXIF to XMP isn't a problem because both XMP tags will be populated in the cases where an EXIF tag maps into multiple XMP tags.

But going from XMP to EXIF is a concern because one must decide which XMP tag to use.  The ExifTool xmp2exif.args file will prioritize the historical mappings (XMP-xmp:CreateDate and XMP-photoshop:DateCreated) over the corresponding CIPA mappings (XMP-exif:DateTimeDigitized and XMP-exif:DateTimeOriginal).

So I would recommend not tampering with the XMP-exif date/time tags because if one of those is edited there is a chance the edit could be lost when coming back to EXIF.

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

Mac2

When I understand you correctly, the issue is caused by the Exif2XMP args file, which updates certain XMP tags. In the first write-back, my software explicitly writes DateTimeOriginal after running the args file and overrides/undoes the Exif2XMP mappings and this results in the DateTimeOriginal being set correctly as written.

In the second write-back, where I only write the rating, the Exif2XMP mapping is applied 'as-is', wiping the last written DateTimeOriginal and replacing it with the value of a different tag.

I'm not sure what my path of action would be.

The user changes XMP-exif:DateTimeOriginal directly (or by proxy by changing XMP-photoshop:DateCreated) and the data has to be stored in the file for both tags. At the same time, the services provided by the XMP2Exif and Exif2XMP args files are very important.

Could probably add something like 

XMP-exif:DateTimeOriginal  < XMP-photoshop:DateCreated 

after running Exif2XMP to ensure that the mapping my software favors is applied?


Phil Harvey

Quote from: Mac2 on January 16, 2025, 10:05:47 AMCould probably add something like

XMP-exif:DateTimeOriginal  < XMP-photoshop:DateCreated

after running Exif2XMP to ensure that the mapping my software favors is applied?

With the upcoming exif2xmp.args of ExifTool 13.13, this would not be necessary since XMP-exif:DateTimeOriginal and XMP-photoshop:DateCreated will contain the identical content.  The problem is that the old argfile didn't copy the time zone portion to XMP-exif:DateTimeOriginal.

The exif2xmp.args patch adds these 2 lines at the end of the argfile:

-XMP-exif:DateTimeOriginal < Composite:SubSecDateTimeOriginal
-XMP-exif:DateTimeDigitized < Composite:SubSecCreateDate

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