Nikon nksc support: -GPSImgDirection still in base64

Started by anubis23, January 21, 2022, 12:08:40 PM

Previous topic - Next topic

anubis23

Hi Phil,

thanks so much for creating and developing exiftool!

The support for Nikon sidecar files from NX Studio is a very welcome new feature in exiftool 12.39. I often use NX Studio to add GPS tracklogs and apply the direction the camera has been pointed at. Until now I had to export these data as CSV to turn them into a readable and usable format for exiftool. This extra-step seems to be history...

But there is a little drawback for now: the -GPSImgDirection is still in double base64 at the exiftool output (exiftool -GPSImgDirection filname.nksc). I'm not very experienced with perl, but I found a way to solve this problem. You will certainly find a better (and correct) one to fix this. Here are my changes (finde the whole file in the attachment):

File: /lib/Image/ExifTool/Nikon.pm

After line 1233 (after %base64coord...) insert:


1234 my %base64dir = (
1235     ValueConv => q{
1236         my $val=Image::ExifTool::XMP::DecodeBase64($val);
1237         my $saveOrder = GetByteOrder();
1238         SetByteOrder('II');
1239         $val = GetDouble($val,0);
1240         SetByteOrder($saveOrder);
1241         $val = sprintf('%.2f', $val);
1242         return $val;
1243     },
1244 );


Line 1241 is only for rounding the output after the second decimal. This is enough for me...

Now at line 11081 (after GPSMapDatum => { },) insert:

11081  GPSImgDirection => { Groups => { 2 => 'Location' }, %base64dir },


Greetings from Germany
Olaf

Phil Harvey

Hi Olaf,

Thanks!  This will be decoded with ExifTool 12.40 which I expect to release later today.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).