Importing Nikon NEF Image Files

I have NEF files from a Nikon camera. How should these be imported to Igor Pro 7? I have read that I can use off-line resources to convert them to standard TIFF. This is a step I would prefer to avoid. My initial tests load the images at what seems to be a reduced resolution (over-pixelated).

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
[quote=thomas_braun]According to wikipedia NEF files are special types of TIFF files [1]. And [2] has found out that there are two images in the TIFF file, the second one being the uncompressed one.

[1]: https://en.wikipedia.org/wiki/Raw_image_format
[2]: http://lclevy.free.fr/nef[/quote]

The references are helpful. Thanks. They suggest that Igor Pro automatically loads the first JPEG image rather than the second raw image.

Does any of this information help to define a flag setting on ImageLoad that will allow me to load the second raw image? I tried an /S=1 and /STRP=1 or /STRP=2 settings ... I still get a pixelated image. The /TILE=... setting does not work (gives an error message about expecting a "{").

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
I changed the filename suffix to .tif and then read it using the command:
imageload/RAT  "HardDisk:Users:ag:Downloads:025mgmL 010uL 03s 2.tif"


This gave me two image waves as well as a bunch of tags and EXIF information (open the Tag0 data folder).

Not sure what else you are expecting.

A.G.
WaveMetrics, Inc.
Hi A.G.

Just tried your procedure and did not get the same result. I only got one image and a folder with the tag info. Given the file is 20mb uncompressed, there certainly was no image of that size. It was only 16 x120 in 3 colors.


Andy
Igor wrote:
I changed the filename suffix to .tif and then read it using the command:...

This gave me two image waves as well as a bunch of tags and EXIF information (open the Tag0 data folder).

Not sure what else you are expecting.


The RAT flag ... thanks for the hint.

I also was unable to get two image files. Only one image at 160 x 120 in unsigned 8 bit color.

I am on macOS 10.12.6 with Igor 7.04.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
If you open the file with Graphics Converter for example, you find that the image is 24MP with 48bits per pixel.

The images that you get using ImageLoad as shown above are only the thumbnails of the real image. If you use the /RAT flag you find that the various tags are not obviously disclosing that information because the key is in the subIFD (tag 330).

The .nef file format documentation can be found here: http://lclevy.free.fr/nef/ You can use the information in section 4.2 to read subIFRD#1 and then hope that the data is uncompressed so you can simply load it using FBinRead or something similar.

If you find that the image is indeed uncompressed it may be worthwhile for you to write a procedure based on this approach. Otherwise you might be better off using a different program to make the conversion from this file format.

FWIW: in Igor 8 I tried to read the sub directory at offset 168872 and found that the image was using compression 34713 which we do not support.

A.G.


Igor wrote:
If you open the file with Graphics Converter for example, you find that the image is 24MP with 48bits per pixel....
FWIW: in Igor 8 I tried to read the sub directory at offset 168872 and found that the image was using compression 34713 which we do not support.


Thanks AG for the detective work!

I see we have run in to the hazards of using a camera with a locked and proprietary file format. Lesson learned.

The ViewNX-i program is able to export a 48bit/pixel TIFF. http://nikonimglib.com/nvnxi/onlinehelp/en/index.html

I'll see what we can do about automating the conversion process using it with scripts or batch files. I'm not inclined to start down a path to write an image file loader.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH