Hi Phil,
I had some help from you a while back (2010-02-03) on writing exposure compensation values into keywords if I was shooting in Exposure Bracketing mode.
Command line:
exiftool -sep ", " '-keywords+<EBV: ${Nikon:ExposureBracketValue}, EC: ${EC}' -overwrite_original -
+if '$Nikon:ShootingMode =~ "Exposure Bracketing"' *.nef
My .ExifTool_config file looks like this:
%Image::ExifTool::UserDefined = (
'Image::ExifTool::Composite' => {
FN => {
Require => 'Nikon:FileNumber',
PrintConv => 'sprintf("%07d",$val)',
},
SC => {
Require => 'Nikon:ShutterCount',
PrintConv => 'sprintf("%07d",$val)',
},
EC => {
Require => {
0 => 'ExposureBracketValue',
1 => 'EXIF:ExposureCompensation',
},
ValueConv => '$val[1] - $val[0]',
PrintConv => 'Image::ExifTool::Exif::ConvertFraction($val)',
},
FEC => {
Require => 'Nikon:FlashExposureComp',
PrintConv => 'Image::ExifTool::Exif::ConvertFraction($val)',
},
},
); #end
I'm making the switch to a perl script because I can't think of a way to use two '-if' conditions--one for exposure compensation, the other for flash compensation (-if 'not $ExifIFD:Flash =~ "No Flash"')--without making two passes.
It looks like I can get where I want to go if I take advantage of the GetValue, SetNewValue and WriteInfo methods of the Image::ExifTool module: 'SetNewValue - Set the new value for a tag. The routine may be called multiple times to set the values of many tags before using "WriteInfo" to write the new values to an image.'
The problem is that I'm seeing duplicate tags for 'Nikon:FlashExposureComp' and they return different values.
Code:
#!/usr/bin/perl
use Image::ExifTool;
my $exifTool = new Image::ExifTool;
my $filename = '20100619-14320274_0025637_3092117.nef';
my $tag1 = 'ExifIFD:Flash';
my $tag2 = 'Nikon:FlashMode';
my $tag3 = 'Nikon:FlashExposureComp';
my $flash = $exifTool->ImageInfo($filename, $tag1, $tag2, $tag3);
foreach (keys %$flash) {
print "$_ => $$flash{$_}\n";
}
FlashExposureComp (1) => -5/3
FlashExposureComp (2) => -5/3
FlashExposureComp => 0
FlashMode => Fired, TTL Mode
Flash => On, Return detected |