Convert image from NEF to TIF

91 Views Asked by At

I do photogrammetry with Nikon cameras. However, I've noticed that when I save my photos in grayscale in JPG format, I get images with three channels and slightly different values on each JPG with 3 channels. So, I've decided to save my photos in RAW format (NEF for Nikon).

I'm looking for software, on Windows, that I could use in command line and that would allow me to read my 14-bit NEF images and convert them to grayscale in 8-bit TIF format.

I found a function with ufraw that does exactly what I want but it's very slow (7 seconds for a 24Mpx image):

ufraw-batch.exe "XXX.NEF" --grayscale=mixer --grayscale-mixer=0.299,0.587,0.114 --out-type=tif --out-depth=8 --output="XXX.tif"

I tried with ImageMagick : magick.exe "XXX.NEF" -colorspace gray -depth 8 "XXX.tif"

However, I get overexposed images (white saturates at 255), I feel like it apply a bad color parameter but I can't apply custom parameters.

Finally, I tried with darktable-cli but I can't convert to grayscale.

Do you have any ideas or tips?

1

There are 1 best solutions below

5
Mark Setchell On

There is a 6000x4000 JPEG embedded in your NEF file which you can extract instantaneously with exiftool as follows:

exiftool -b -JpgFromRaw 043_0010.NEF  > preview.jpg

Maybe that is useful to you? You can convert it to TIFF if you want to with ImageMagick:

exiftool -b -JpgFromRaw 043_0010.NEF | magick - -compress LZW preview.tif

Extra info... by the way, you can find all the information buried in your NEF file using:

exiftool -s 043_0010.NEF 

Then I just looked for the name of the biggest binary lump to extract with -b option on the basis that that is probably the best quality. Doubtless more scientific approaches exist