ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Viktor Nemeth on June 19, 2023, 06:16:45 AM

Title: Can't set timezone/offset in XMP sidecar
Post by: Viktor Nemeth on June 19, 2023, 06:16:45 AM
Hello,

I am trying to save the TZ offset in just about any way (like, any, I don't mind how, but I need to be able read it back) in an XMP sidecar file
Logic I'm using:
I have a NEF file out of the camera. There is no XMP file at this point.
I make some modifications in Camera Raw, save it, that creates an XMP file. It now has values like:
xmp:CreateDate="2023-06-18T07:39:40.28+01:00"
exif:DateTimeOriginal="2023-06-18T07:39:40.28+01:00"

Now let's say I want to change either of those values to anything arbitrary but say "2004-10-23T12:00:00-06:00" this is the logic defined in https://www.w3.org/TR/NOTE-datetime and in the XMP official documentation file as well (pg 21 if anyone needs it)
So I have an args file that has:
D:\temp\20230618\_DSC2511.xmp
-progress
-XMP-photoshop:DateCreated=2004-10-23T12:00:00-06:00
-EXIF:DateTimeOriginal=2004-10-23T12:00:00-06:00
-xmp:CreateDate=2004-10-23T12:00:00-06:00
-overwrite_original_in_place
-execute

Then when running the command I get the 1 image files updated log, however in the xmp file I now have
<photoshop:DateCreated>2004-10-23T12:00:00</photoshop:DateCreated> // no tz
<exif:DateTimeOriginal>2023-06-18T07:39:40.28+01:00</exif:DateTimeOriginal> //  unchanged
<xmp:CreateDate>2004-10-23T12:00:00</xmp:CreateDate> // no tz

What am I doing wrong?
Title: Re: Can't set timezone/offset in XMP sidecar
Post by: Phil Harvey on June 19, 2023, 07:29:14 AM
First, you should read FAQ 5 (https://exiftool.org/faq.html#Q5).

Second, XMP files can't contain EXIF metadata.  (You should be writing XMP-exif, not EXIF.)

Third, when I run your command the TZ is written to DateCreated.  What version of ExifTool are you using?

- Phil
Title: Re: Can't set timezone/offset in XMP sidecar
Post by: Viktor Nemeth on June 19, 2023, 12:44:24 PM
Ahhhh I'm an idiot - nevermind.

I had a config setting in .ExifTool_config
%Image::ExifTool::UserDefined::Options = (
    CoordFormat => '%+.6f', 
    DateFormat => '%Y-%m-%d %H:%M:%S'

...which overwrote the command. My bad.