ExifTool Forum

ExifTool => Developers => Topic started by: helzayat on March 06, 2013, 07:34:57 AM

Title: exiftool behavior in ResourceSpace with NEF files
Post by: helzayat on March 06, 2013, 07:34:57 AM
I am setting up a ResourceSpace system, and noticed some strange behavior when using exiftool to extract the preview from raw Nikon NEF files. In a given batch, all shot on the same day using the same camera, some photos have the alternate (high res print, low res print, screen, etc.) files created and some do not. If I let ImageMagick handle the preview creation they are created for all photos. Jeff Harmon at Colorhythm suggested on the Resourcespace forum that I report this to you here.
Title: Re: exiftool behavior in ResourceSpace with NEF files
Post by: Phil Harvey on March 06, 2013, 07:37:18 AM
If you could send me a sample of each type I'll take a look.  I'm guessing that in one case the file was downloaded and modified by the Nikon software.  My email is philharvey66 at gmail.com

- Phil
Title: Re: exiftool behavior in ResourceSpace with NEF files
Post by: Phil Harvey on March 06, 2013, 09:31:06 AM
I got the samples, thanks.

DSC0637 is a good D200 NEF image, straight from the camera.

DSC0568 has been modified by some software, possibly Nikon Capture (since there is some additional Nikon-Capture-specific metadata in this file).  Whatever rewrote this file added a small JPEG preview image, but there are various errors in the structure of this image, so the software is buggy.

The software put the new small JPEG in the place where ExifTool expects the NEF JpgFromRaw image (the 0th SubIFD), so for this NEF the large JPEG would be extracted as OtherImage instead of JpgFromRaw (since it was moved to SubIFD1).  Here are the image sizes and where they are located in these files:

> exiftool ~/Desktop/ -ext nef -G1 -a "-*length" "--*focal*"
======== /Users/phil/Desktop/24-04-06@12-38-16 _DSC0568 D200 ISO200 190mm 750th f8.0.NEF
[SubIFD]        Jpg From Raw Length             : 56556
[SubIFD1]       Other Image Length              : 884110
[PreviewIFD]    Preview Image Length            : 106740
======== /Users/phil/Desktop/24-04-06@13-23-45 _DSC0637 D200 ISO200 50mm 45th f2.8.NEF
[SubIFD]        Jpg From Raw Length             : 717548
[PreviewIFD]    Preview Image Length            : 110002
    1 directories scanned
    2 image files read


If you are interested in extracting the largest embedded JPEG, look at the BigImage tag in the sample config file (https://exiftool.org/config.html).  This custom tag will return JpgFromRaw for DSC0637 and OtherImage for DSC0568.

- Phil
Title: Re: exiftool behavior in ResourceSpace with NEF files
Post by: helzayat on March 06, 2013, 11:33:46 AM
Thanks for looking at those files. I'm not sure how to use the information you gave me. I tried simply putting the sample config file in the same directory as exiftool (/usr/bin in Ubuntu 12.04) but that made no difference.
Title: Re: exiftool behavior in ResourceSpace with NEF files
Post by: Phil Harvey on March 06, 2013, 12:18:05 PM
With the sample config file renamed to ".ExifTool_config" in the exiftool directory you should see a new tag named BigImage that you can use to access the largest embedded JPEG.

- Phil
Title: Re: exiftool behavior in ResourceSpace with NEF files
Post by: helzayat on March 07, 2013, 05:51:27 AM
Does exiftool 9.22 support the Nikon D700?
I tried a file straight from the D700 and got the same problem with it. Except for renaming it, nothing was done to it in any Nikon, or other, software.
Title: Re: exiftool behavior in ResourceSpace with NEF files
Post by: Phil Harvey on March 07, 2013, 07:38:42 AM
Yes, ExifTool supports NEF files from all Nikon models.  Here is what I get for a D700 sample:

> exiftool ../pics/NikonD700.nef -G1 -a -jpgfromraw "-*image"
[Composite]     Jpg From Raw                    : (Binary data 1517702 bytes, use -b option to extract)
[Composite]     Preview Image                   : (Binary data 103142 bytes, use -b option to extract)
[Composite]     Big Image                       : (Binary data 1517702 bytes, use -b option to extract)


- Phil