Cannot set XMP:DateTimeOriginal of JPG image

Started by Louis Strous, April 09, 2016, 10:31:36 AM

Previous topic - Next topic

Louis Strous

I seem unable to set the XMP:DateTimeOriginal tag of a JPG image.  I tried it using the exiftool application but did not succeed.  It responded with "1 image files updated" but the desired tag was not in the image afterwards.  The preexisting EXIF:DateTimeOriginal tag remained in the image with its original value, which is different from the value I tried to assign to the not-preexisting XMP::DateTimeOriginal tag.  I was able to assign a value to the not-preexisting XMP:City tag.

I then tried it using the Exif::ImageTool module from small perl script image-exiftool-xmp-bug.pl (called without any arguments), which I attach.  I also attach the small image file that the script uses; place in the same directory.

I'm using Image::ExifTool version 10.14 with Strawberry Perl 5.18.2 on Windows 7 (64 bits).

I think I've traced the problem to the neighborhood of the &$writeProc() call on line 507 of Image::ExifTool::SetNewValue in Image/ExifTool/Writer.pm.  The code looks like this:


            if (not $ifdName and /^XMP\b/i) {
                my $table = GetTagTable('Image::ExifTool::XMP::Main');
                my $writeProc = $$table{WRITE_PROC};
                $writeProc and &$writeProc();
            }


Note that local variable $table is assigned but not used.  The &$writeProc() expression calls Image::ExifTool::XMP::WriteXMP (in Image/ExifTool/WriteXMP.pm) but without any arguments.  The called sub expects arguments $et, $dirInfo, $tagTablePtr and returns 1 immediately if $et is undefined.  The unused $table seems suitable for the 3rd argument, and SetNewValue's $self value seems suitable for the 1st argument, but I don't know where to find a suitable value for the 2nd argument, which is expected to be a hash reference with several specific keys, including DataPt and DirLen.

FYI: My original reason to try this was to figure out if XMP:DateTimeOriginal accepts a time zone offset.  EXIF:DateTimeOriginal and the other embedded EXIF timestamps do not.

Regards,
Louis Strous

Phil Harvey

This really sounds like FAQ 3.  ExifTool should not say that the file was updated if nothing was written.

The only function of the code segment you posted is to load the XMP module (which does things like generate the flattened structure tags).  The dummy call to WRITE_PROC itself doesn't do anything else.

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

Louis Strous

You are right.  exiftool -a -G -S does show the XMP:DateTimeOriginal tag.  My apologies for wasting your time.

Regards,
Louis Strous