[Originally posted by jacktanner on 2008-02-25 05:13:05-08]I don't know if this is a bug, but at the least it seems non-obvious.
I needed to alter the date tags for RAW photos taken with a Nikon D40. Via the API, I could alter FileModifyDate and DateTimeOrignal, but not ModifyDate or CreateDate. I did manage to alter all of the above via the command line. Here's the API invocation I used, straight out of the tutorial:
my @date_fields = qw(DateTimeOriginal ModifyDate CreateDate);
my $info = $exifTool->ImageInfo($file);
foreach (@date_fields) {
$exifTool->SetNewValue($_ => $date);
}
$exifTool->WriteInfo($file,"foo.nef");
That failed for ModifyDate and CreateDate, but this worked:
exiftool "-CreateDate=2008:02:24 12:55:51" foo.nef
Using exiftool 7.00 on Fedora 8.
[Originally posted by exiftool on 2008-02-25 13:54:33-08]This works fine for me, perhaps you could test it:
> ./exiftool a.nef -alldates -a -G1
[ExifIFD] Date/Time Original : 2007:12:08 06:57:31
[IFD0] Date/Time Original : 2007:12:08 06:57:31
[ExifIFD] Create Date : 2007:12:08 06:57:31
[IFD0] Modify Date : 2007:12:08 06:57:31
> ./exiftool b.nef -alldates -a -G1
File not found: b.nef
> ./ttt a.nef b.nef "2999:99:99 99:99:99"
WriteInfo returned 1
> ./exiftool b.nef -alldates -a -G1
[ExifIFD] Date/Time Original : 2999:99:99 99:99:99
[ExifIFD] Create Date : 2999:99:99 99:99:99
[IFD0] Modify Date : 2999:99:99 99:99:99
> cat ttt
#!/usr/bin/perl -w
use strict;
BEGIN { push @INC, 'lib' }
use Image::ExifTool;
my $infile = shift;
my $outfile = shift;
my $date = shift;
my @date_fields = qw(DateTimeOriginal ModifyDate CreateDate);
my $exifTool = new Image::ExifTool;
foreach (@date_fields) {
$exifTool->SetNewValue($_ => $date);
}
my $rtn = $exifTool->WriteInfo($infile,$outfile);
print "WriteInfo returned $rtn\n";
foreach ('Error', 'Warning') {
my $val = $exifTool->GetValue($_);
print "$_: $val\n" if $val;
}
# end
- Phil