problem with Nikon nefs

Started by Alan Clifford, April 02, 2011, 01:53:06 PM

Previous topic - Next topic

Alan Clifford

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





Phil Harvey

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

Alan Clifford


Phil Harvey

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

Phil Harvey

#4
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 to try to explain this.
...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 ($).

Alan Clifford

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