Hi Phil.
I have a problem with nefs that I don't have with jpegs using nikon:timezone#
I've created a short example
use strict;
use warnings;
# my $photofilespec = './dsc_8635.nef' ;
# my $photofilespec = './dsc_8635.jpg' ;
my $photofilespec = './ahc_1177.nef' ;
# my $photofilespec = './ahc_1177.jpg' ;
# my $photofilespec = './ahc_0559.nef' ;
use Image::ExifTool;
my $n_exifTool = new Image::ExifTool;
my @n_dtotags = ( 'exif:DateTimeOriginal', 'nikon:timezone#',
'nikon:daylightsavings#', 'nikon:datetimeoriginal' );
my $n_dtoinfo = $n_exifTool->ImageInfo($photofilespec, \@n_dtotags) ;
print STDERR "\$\$n_dtoinfo{\$n_dtotags[0]} = $$n_dtoinfo{$n_dtotags[0]}\n" ;
print STDERR "\$\$n_dtoinfo{\$n_dtotags[1]} = $$n_dtoinfo{$n_dtotags[1]}\n" ;
This results in
alan@coprolith:timezonetest$ perl debugit.pl
$$n_dtoinfo{$n_dtotags[0]} = 2011:02:28 18:07:50
$$n_dtoinfo{$n_dtotags[1]} = 2011:02:28 18:07:50
whereas the command line
exiftool -exif:DateTimeOriginal -nikon:timezone# -nikon:daylightsavings# -nikon:datetimeoriginal ahc_1177.nef
gives
Date/Time Original : 2011:02:28 18:07:50
Timezone : -180
Daylight Savings : 1
With a jpg created from the nef, the code works as expected
alan@coprolith:timezonetest$ perl debugit.pl $$n_dtoinfo{$n_dtotags[0]} = 2011:02:28 18:07:50
$$n_dtoinfo{$n_dtotags[1]} = -180
Alan
Hi Alan
This will happen if there are multiple EXIF:DateTimeOriginal tags.
I would normally suggest setting Duplicates to 0, but since you want a specific group this won't work because your tag may get hidden by another group.
You could either check the tag name or call GetInfo separately for each tag to be sure you get the right one.
- Phil
Thanks, I'll try that.
Alan
Hi again Alan,
Thinking about this again, I think I was wrong about the Duplicates option hiding other tags -- this only happens when extracting tags for an entire group with GROUP:all.
So just setting Duplicates to 0 may solve the problem after all.
- Phil
Hi Alan,
I'm back on my computer so I can look into this in detail and give a definitive answer today. (Yesterday I was replying from my iPod.)
Setting Duplicates to 0 does solve your problem.
- Phil
Edit: I have updated the description of the "ARRAY ref" argument in the ImageInfo documentation (https://exiftool.org/ExifTool.html#ImageInfo) to try to explain this.
Quote from: Phil Harvey on April 03, 2011, 07:29:27 AM
Setting Duplicates to 0 does solve your problem.
- Phil
Thanks Phil, I was just about to query that.
I saw using the command line tool with -a -G that there are two exif:datetimeorginals (I wonder why) but this code was OK
$n_exifTool->Options(Duplicates => 0);
my @n_dtotags = ( 'exif:DateTimeOriginal', 'nikon:timezone#',
'nikon:daylightsavings#', 'xmp:DateTimeOriginal' );
avoiding one of the exifs but getting the xmp
Alan