Page 1 of 3

Cannot convert New NEF format

Posted: 2008-05-05T16:34:43-07:00
by Musfuut
Nikon recently updated their NEF format for such cameras as the D300, D3, etc. Trying to convert such images as a NEF results in a black frame with scattered specks of color. Photoshop versions prior to CS3+Updated Camera RAW is also unable to properly read the image and results in the same image. Adobe as well as a number of other companies have updated their products to work with this new format so the specs shouldn't be hard to find.

The images are in the range of 15-30mb each, if you need me to upload one I can to something like rapidshare.

I hope the solution is more simple than this.

What I typed:
convert DSC_0407.NEF test_image.jpg
test_image.jpg is as described above

The version of IM I am using is 6.4.1.0-Q16-Windows-DLL

Thanks for any help you can provide!

Re: Cannot convert New NEF format

Posted: 2008-05-05T16:52:38-07:00
by magick
Post a URL to one of your images here. We need to download and reproduce the problem before we can offer any assistance.

Re: Cannot convert New NEF format

Posted: 2008-05-05T18:34:10-07:00
by Musfuut
Alrighty, here is a link to the unreadable NEF format, as well as a working JPEG of the same image so you know what the resulting image should look like.
NEF: http://rapidshare.com/files/112863837/DSC_2814.NEF.html
JPEG: http://rapidshare.com/files/112863835/DSC_2814.JPG.html

Sorry for the rapidshare hosting, I have no other host.

I should note that this is one specific example NEF, the D300 and D3 Nikons are able to produce 6 different NEF formats.

12-bit or 14-bit, in either Lossless Compressed, Lossy Compressed, or Uncompressed.

The example above is 14-bit Lossy Compressed NEF.

Thanks a lot!

Re: Cannot convert New NEF format

Posted: 2008-05-05T19:00:10-07:00
by magick
We can display your image under Linux using ImageMagick 6.4.1-0. The Windows distribution uses a slightly different delegate for reading RAW images. We will investigate and post the results within the next few days.

Re: Cannot convert New NEF format

Posted: 2008-05-11T14:00:49-07:00
by skydive
I think the problem deals with the version of dcraw who is the delegate for NEF files under Windows. Support for the D300 starts with dcraw 8.83. (http://www.insflug.org/raw/Downloads/). With previous versions of dcraw, i had some black images too.
I just installed IM 6.4.1.1-Q16-Windows-DLL and dcraw has been updated to dcraw 8.86 instead of dcraw 8.53 in IM 6.4.1.0-Q16-Windows-DLL.
But now, there is a problem with the delegate. I have got the following error :

Code: Select all

c:\>convert nef:DSC_2515.NEF DSC_2515.NEF.jpg
convert: unable to open image `C:/Users/olivier/AppData/Local/Temp/magick-qSmifnki.pnm': No such file or directory.
convert: missing an image filename `DSC_2515.NEF.jpg'.
I made some changes in delegates.xml in order to get verbose output (<delegate decode="dng:decode" stealth="False" command="dcraw.exe -v -4 -w -O "%u.pnm" "%i""/>) :

Code: Select all

 
c:\>convert nef:DSC_2515.NEF DSC_2515.NEF.jpg
Loading NIKON D300 image from C:/Users/olivier/AppData/Local/Temp/magick-SbwSCJws ...
Scaling with darkness 0, saturation 16383, and
multipliers 1.773438 1.000000 1.312500 1.000000
AHD interpolation...
Converting to sRGB colorspace...
Writing data to C:/Users/olivier/AppData/Local/Temp/magick-qp99tB-K.pnm ...
convert: unable to open image `C:/Users/olivier/AppData/Local/Temp/magick-qp99tB-K.pnm': No such file or directory.
convert: missing an image filename `DSC_2515.NEF.jpg'.
I don't know what is the "-O" option. There is no such option in dcraw help (only -o). Is it a patch applied to dcraw for IM?. The source of dcraw in ftp://ftp.imagemagick.net/pub/ImageMagick/delegates/ is not up to date (dcraw-8.53.tar.gz instead of dcraw-8.86.tar.gz)

Re: Cannot convert New NEF format

Posted: 2008-05-11T15:00:39-07:00
by magick
Right, dcraw requires a patch to support -O for the output filename. We'll update to 8.86 within a few days.

Re: Cannot convert New NEF format

Posted: 2008-05-11T16:54:06-07:00
by skydive
:D I made the patch by myself ! Here is the diff :

Code: Select all

H:\dcraw>diff "dcraw - Copie.c" dcraw.c
61a62,65
> #ifdef WIN32
> #define fseeko _fseeki64
> #define ftello _ftelli64
> #else
63a68
> #endif
104a110
> char *outfile= '\0';
8207a8214
>       case 'O':  outfile    = argv[arg++];  break;
8440c8447,8452
<       strcpy (ofname, ifname);
---
>
>       if (outfile)
>         strcpy (ofname,outfile);
>       else {
>
>         strcpy (ofname, ifname);
8447a8460,8462
>
>       }
>
The integration with IM works, but the resulting jpeg are very dark ! :(

I put all the files (.c .exe .nef .tif .jpg) here :

ftp.olevon.eu
user magick
password magick

Hope it wil help a bit !

Re: Cannot convert New NEF format

Posted: 2008-05-11T17:26:10-07:00
by magick
By default ImageMagick produces linear samples (fixed white level, no gamma). You can edit the delegate.xml configuration file and remove the -4 dcraw option to autocorrect the color to get brighter images.

Re: Cannot convert New NEF format

Posted: 2009-05-28T14:49:51-07:00
by skydive
The advice works fine.

But the dcraw build included in the latest version of ImagMagick is still a bit old (8.86 in IM 6.5.2). That build doesn't support my new D700 (DCRaw 8.88/1.404 at least is needed).
So I made my own build of dcraw (v 8.94) patched for use with ImageMagick (-O outputfile option added).

It's built with Microsoft's compiler (VS 2003 and PSDK 2003), LibJPEG and LCMS support. It's optimized for P IV processors.

This build is available on my website here : http://photopara.net/dcraw.exe
And also the patch applied : http://photopara.net/dcraw_diff.txt

If you need, I can provide some refreshed and patched versions of dcraw in the future. I'm currently writing a build how-to...

Re: Cannot convert New NEF format

Posted: 2009-05-28T17:22:31-07:00
by magick
We'll get your version of dcraw into the next point release. Feel free to post here as updates are made and thanks.

Re: Cannot convert New NEF format

Posted: 2009-06-09T15:45:32-07:00
by skydive
An updated build (dcraw 8.95) is available here : http://photopara.net/dcraw.exe
And also the patch applied : http://photopara.net/dcraw_diff.txt

Re: Cannot convert New NEF format

Posted: 2009-09-23T13:02:34-07:00
by skydive
dcraw 8.98 1.431 build against libjpeg 7 and lcms 1.18 is available

Re: Cannot convert New NEF format

Posted: 2009-09-23T18:35:13-07:00
by magick
Got it. Look for it in the ImageMagick Subversion trunk by sometime tomorrow. Thanks.

Re: Cannot convert New NEF format

Posted: 2009-12-29T12:50:11-07:00
by skydive
dcraw 8.99 1.432 built against libjpeg 7 and lcms 1.19 is available

Re: Cannot convert New NEF format

Posted: 2009-12-29T14:34:55-07:00
by Wilbert
I downloaded ImageMagick-6.5.8-5.zip from ftp://ftp.imagemagick.org/pub/ImageMagick/windows/:

I got a similar error as skydive did:

Code: Select all

c:\>convert nef:DSC_2515.NEF DSC_2515.NEF.jpg
convert: unable to open image `C:/Users/olivier/AppData/Local/Temp/magick-qSmifnki.pnm': No such file or directory.
convert: missing an image filename `DSC_2515.NEF.jpg'.
Didn't those patches make it to the package i used?