Wednesday, July 20, 2011

DNG2NEF version 1.0 is out!

Ok, version one is finished, and complete for my own needs. This tool now correctly transfer the white balance values from the DNG to the NEF, is a tad quicker, and also updates the thumbnail, which was pending from the first drafts. One caveat though, is the aperture, which is guessed on the M9 and strangely coded. The value transferred to NX is not quite accurate. I personally do not bother too much about this value after the photo is taken.

I have been processing a few hundreds of Leica M9 files without a single problem, and then they go into my usual browsing with Photomechanic and adjustments in Capture NX 2 workflow as D3x files.

For those using windows, here is the tool, dng2nef.zip
Tcl source code is available here, dng2nef.tcl

See a DNG file open by Camera Raw,

















 
Or edited as NEF in Capture NX 2,
 



32 comments:

  1. thank you for writing this tool.. are the color modes in nef supported after dng is converted?

    ReplyDelete
  2. Running your tcl script in Mac OS X returns the message:

    Converting example.dng
    You need dcRaw to generate the JPG preview!!! couldn't execute "dcraw": no such file or directory
    Process finished!!!

    Where can I get a OSX-compatible copy of dcraw??

    ReplyDelete
  3. Al,

    All "Picture control" modes can be applied to the resulting NEF, just change that in CNX2. The M9 should be set to use aRGB to be coherent with the provided template.nef.

    celticursa,

    Check here,

    http://www.cybercom.net/~dcoffin/dcraw/
    http://www.insflug.org/raw/

    Thanks for stopping by!

    ReplyDelete
  4. What changes are needed in the template.nef file for use with sRGB color files?

    ReplyDelete
  5. Hi celticursa,

    You can use your own nef file as a template. In any case, I have posted a prepared template, with the colorspace set to sRGB.

    ReplyDelete
  6. Great job, unfortunately i am not a M9 owner. I just have a X1 to complete my D3. Could you do the same job for X1 - DNG files?

    ReplyDelete
  7. Hi Coolpixeler,

    Send me an X1 DNG file, and I'll see what can be done.

    ReplyDelete
  8. Hi Miguel thank you very much!
    I put a picture here
    http://what-eye-saw.net/BIGPIC/LX1_06078
    could you download it? Without the DNG extension my browser ask me for a choice and I can download it. With the extension i cannot.

    ReplyDelete
  9. Hi Coolpixeler,

    Nice pic! I think it can be done. Moreover, your D3 and X1 have the same resolution, so the resulting NEFs will need no crop.

    Give me some time. I'll keep you posted.

    Regards,
    Miguel

    ReplyDelete
  10. Great news! Take your time and thank you again.

    ReplyDelete
  11. Great Work!!!
    Could this be used with DNG files created by the Adobe DNG converter as well?

    ReplyDelete
  12. Anything can be done, but the DNG is quite a wide spec to cover all cases and formats.

    And those DNG converted files would come from which raw format?

    ReplyDelete
  13. Ah, I thought that at least converted files have all the same DNG spec.
    Beside the D300 I use the Fuji X100 and Canon S95.

    ReplyDelete
  14. The DNG spec includes camera profile information so that RAW converters can understand a huge range of different sensor readings. This includes from the Bayer array pattern to bit depths, camera calibration settings, etc. In principle, one could use all that to create a NEF file, but the task is not easy.

    In the case of this converted, there are many similarities between the M9 DNG and the NEF 14bit file, so the conversion is mostly straightforward without having to alter/process the raw data itself.

    I'm now playing with the Leica X1, I'll post results in a few days. That Fuji X100 of yours is also interesting, I'll have a look to it as well.

    ReplyDelete
  15. I think that there are many people who would like a conversion from Fuji RAF to NEF (possible via DNG). Many poeple like using Capture NX2 and do not like the Fuji Raw option (ie Silky Pics). That includes me. I would welcome a converter. Gary (gheald@btinternet.com)

    ReplyDelete
  16. Thanks Gary,

    I have already been playing with the Fuji RAF format, quite undocumented. Indeed, going through DNG makes the conversion easier, but quite slow.

    Point taken, now I have two people asking for it. The forthcoming 64bit NEF libraries from Nikon will make dng2nef faster, we'll see the best approach.

    ReplyDelete
  17. Great job, but I just have a Canon Powershot SX20-IS and (by CHDK) I can capture a DNG.
    Could you do the same job for this type of DNG files?
    I have a DSLR Nikon, I love Capture MX2 and I would use it for my DNG CHDK too.
    Thank you

    claross@katamail.com

    ReplyDelete
  18. Hi claross,

    It could be done, but I'm finally going to support only Leica DNGs, as far as I still use them. The unsuccessful trial with the undocumented Fuji RAF format have dissuaded me to support cameras that I do not have.

    Regards

    ReplyDelete
  19. Hello Miguel,

    Any intentions to support for the new M240?
    Thanks.

    ReplyDelete
  20. Yes, it's already supported, use this version:

    http://bagnonm.blogspot.com.es/search/label/RAW2NEF

    ReplyDelete
  21. Any chance you can convert Phase One IIQ files to Nef?

    ReplyDelete
  22. I think your Phase One may deliver 16bit images? The NEF format only has room for 14 bit images, so it may not be very useful to loose that information due to the conversion. Maybe when Nikon starts producing real 16bit cameras ...

    ReplyDelete
  23. I use Nikon's CoolScan V ED LS-50 Film Scanner and the device can output image files in NEF format that can be processed by Nikon Capture NX2. Using Adobe's utility to convert the NEF files to DNG, can your utility convert the final Adobe PS/Lightroom processed DNG image files back to NEF format?

    ReplyDelete
  24. The CoolScan V ED LS-50 Film Scanner outputs 14-bit resolution images which is compatible with 14-bit resolution of the Nikon D3X digital camera which is the template you are using to convert the Leica DNG image files to NEF format,

    ReplyDelete
  25. Hi Anonymous,

    I'm afraid once you have processed your DNGs, the resulting image is going to be in jpg/tiff, which has no way back to raw format. The raw format has the reading of each of the r-g-b sensors, whereas the processed image now will hold a full colour information for each pixel of the image. So, no way back to your NEF once they go through PS/Lightroom.

    ReplyDelete
  26. I downloaded your utility, converted the CoolScan NEF files to DNG using Adobe's latest Raw Converter 8.3. When I re-converted the DNG back to NEF using your utility, the utility rejected it because it is not one of the devices it supports because the EXIF profile of the NEF file is a CoolScan Scanner file. There is an EXIF tool uility (from the Nikon DF.com website) that I just found and will change the NEF's device to something supported by your utility and report back to you the results.

    ReplyDelete
  27. I just tested the EXIFTool changing the device model from Nikon Coolscan to S2 of my original NEF file, converted the newly generated NEF file to DNG format using Adobe Raw Converter 8.5. When I converted the DNG format using your utility, it gave me an error that DNG using Raw Converter 8.5 is not supported. So what version of Adobe Raw Converter does your utility support? I know the Nikon CoolScan NEF files are uncompressed as my images are 135 MB size. I will be waiting for your utility updates once the Nikon NX-D comes out on July 15, 2014 as you stated in one of your blogs. I can process the DNG file using Lightroom, but your utility if you support more DNG files from other cameras or Nikon devices, you can actually sell to photographers who want to keep their files in NEF format. BTW, the exiftool I got from http://owl.phy.queensu.ca/~phil/exiftool/#features.

    ReplyDelete
    Replies
    1. The only variants of DNG that this tool supports are those generated by the supported Leica cameras. The RAW/NEF data are the direct reading from the camera sensor, which is a Bayer array of red/green/blue sensors. When you process these, you get a proper file format, like jpg or tiff, which now has calculated the proper color for each image pixel. Image pixels are not given directlt by the proper r/g/b sensors, there is some math involved. All raw converters and photo processing are meant to be one way, from the raw sensor readings to the final image, and not the other way, which would involve to calculate or guess a similar sensor reading that would yield to your final image under some default image processing parameters. Overwriting your initial sensor values with calculated ones would leave you with no fall back, as you would not be able to have the initial values again.

      Delete
  28. This is me again, the user of the Coolscan NEF images. I thought Lightroom can process DNG natively and apply the changes and the changes are stored in another XML file so that your utility can still convert and apply what Lightroom did to come up with the final version in NEF format. This is what the Adobe RAW Converter does with my NEF files processed by Capture NX2: When the converted DNG image is displayed, it is much like the original scanner NEF files without the effects I put in Capture NX2.
    So what you are saying is when I have the NEF file already in DNG, processed by Lightroom using different plug-ins and saved as DNG, the processed DNG can no longer go back to NEF? Still I can convert the processed DNG to TIFF or JPEG using the highest conversion quality. When I convert processed NEF files to JPEG or TIFF in Capture-NX2, the resulting JPEG resemble the processed NEF files and not the original, likewise, Lightroom may be doing the same with the DNG files, where all the changes are separate from the original DNG files and can therefore be interpreted to make a newer version of the NEF file. Is what I am saying correct?

    ReplyDelete
    Replies
    1. Yes, edits from a DNG/RAW are not reversible to pure RAW format. DNG is also capable of carrying the processed JPG/TIFF inside, but it does not mean that Lightroom updates the original RAW data in the DNG.

      Delete
  29. If you dig into DNG specification, you will see that it is not ONE file format, rather it's a wrapper to transport the native RAW with sufficient description fields to allow a RAW converter to understand it, My tool only understands those DNGs produced by the supported Leica cameras. Other DNG files may have very different sensor geometries and characteristics, like thar from your Coolscan, A full blown RAW converter needs to be ready to handle the complex level of abstraction that DNG implies, but againg, this little tool only understands some Leica output formats.

    ReplyDelete
  30. Great Post !

    We all appreciate with your blog information. This is very help to all learner and user of these type of software user.

    Keep up sharing...

    NX Converter

    ReplyDelete