NEF To DNG Conversion
 
Support Ukraine

NEF To DNG Conversion

A good long while back I did a comparison of RAW and JPEG as image formats. The conclusion then was that RAW has suddenly become useful for some cases - when one needs to capture a high-dynamic range scene and can do so by exposing for highlights, can shoot at base ISO, and can't or won't bracket. To that I can add that RAW is very useful for astrophotography, and when the white balance is difficult or you expect to require different white balance settings for different parts of the image.

I still stand by my estimate back then that this is quite a rare event. But the Raw vs. Jpeg comparison was done over three years ago - and rare as the event may be, over three years you do accumulate a couple of RAW files. About 2,000 to be exact. (Compare that to about 40,000 JPEGs.) Challengers like Google's WebP[a] and now BPG[b] notwithstanding[1], I expect JPEG to be "good enough" for a good many years more, and readable for a great many years beyond that.

The same thing can't be said for Nikon's raw NEF files. Being Nikon's proprietary file format, they contain stuff only Nikon knows how to interpret and should Nikon go belly up... ...well, hope you interpreted what you needed to interpret by then. So I started looking into converting my NEF files into Adobe's Digital Negative format - DNG.

1. DNG

DNG is sort of an "open raw format". It is supposed to be a superset of all RAW formats, being able to store everything that every RAW format contains in a standard way. The American Society of Media Photographers[d] recommends using DNG for archiving, and the Library of Congress lists DNG as a preferred alternative to RAW[e].

2. Tests

I'm generally suspicious of "supreme data formats". Since they rarely are ahead of the curve when defining data items, they tend to have almost but not perfect ability to absorb all the data of other formats: 99% gets converted OK, but the last 1% is lost. So I set out to see just what DNG would drop on the floor. As a sample, I used a RAW photo of my toy camel.

  1. I started with the out-of-camera NEF.

  2. Then I wrote GPS data to the NEF and to an XMP sidecar file.

  3. I wrote a description and a Microsoft face tag to the XMP sidecar file.

  4. I used Adobe's DNG Converter[f] to convert the NEF+XMP to:

    • DNG

    • DNG with embedded original file

  5. I extracted the NEF from the DNG with embedded original file.

  6. I used exiftool[g] to extract all metadata from all files.

3. Summary of Results

The image data was handled without any issues. The DNG, when opened in Adobe Camera Raw, yielded exactly the same image data as the original NEF.

The "embed original image data" option also does exactly what it says on the box. The original NEF could be extracted with no changes whatsoever. The sidecar XMP could not be extracted, however.

The metadata was shuffled around a bit. The XMP data was merged with the NEF data and put into the DNG file, with the NEF data having priority in case of data being defined in both. The DNG converter then added some fields of its own. Both the description and the face tags were converted perfectly, something I verified by having exiftool extract XMP from the DNG.

For the raw data, see the diff viewer below.

4. Conclusion

Well, gee, I dunno... Having the file format endorsed by the Library of Congress is a good thing, I suppose - but then they also recommend JPEG2000, which makes me a bit nervous as that is one of those "state of the art better than JPEG" formats that failed to go anywhere. Most likely, I'll go for DNG with embedded NEF. If something goes wrong, and I find out that I should have used a different converter, or a different setting, or something else, I'll at least be able to get my NEFs back. Yes, my DNGs will be twice as lovely, but then again I don't shoot much RAW so in the grand scheme of things it won't make that much of a difference.

5. Diff Viewer

Show

Key
Active Area0 0 4012 6034
Analog Balance1 1 1
Anti Alias Strength1
Aperture Value2.0
Approximate Focus Distance0.35
As Shot Neutral0.761905 1 0.442907
Baseline Exposure0.35
Baseline Noise1
Baseline Sharpness1
Bayer Green Split250
Best Quality Scale1
Bits Per Sample12; 8 8 816; 8 8 8
Black Level0
Black Level Repeat Dim1 1
CFA LayoutRectangular
CFA Plane ColorRed,Green,Blue
Calibration Illuminant 1Standard Light A
Calibration Illuminant 2D65
Camera Calibration 11 0 0 0 1 0 0 0 1
Camera Calibration 21 0 0 0 1 0 0 0 1
Camera Calibration Sigcom.adobe
Camera Serial Number6097333
Color Matrix 10.7179 -0.1985 0.0103 -0.4102 1.0944 0.3649 -0.0609 0.1585 0.8185
Color Matrix 20.7013 -0.1408 -0.0635 -0.5268 1.2902 0.264 -0.147 0.2801 0.7379
CompressionJPEG (old-style); Nikon NEF Compressed; UncompressedJPEG; JPEG (old-style); Uncompressed
Create Date2014:12:16 17:46:00; 2014:12:16 17:46:00.202014:12:16 17:46:00; 2014:12:16 17:46:00+01:00
Creator ToolAdobe DNG Converter 8.7 (Windows)
DNG Backward Version1.1.0.0
DNG Lens Info35mm f/1.8
DNG Version1.4.0.0
Date Created2014:12:16 17:46:00+01:00
Date/Time Digitized2014:12:16 17:46:00+01:00
Date/Time Original2014:12:16 17:46:00; 2014:12:16 17:46:00+01:00; 2014:12:16 17:46:00.202014:12:16 17:46:00
Default Crop Origin8 6
Default Crop Size6016 4000
Default Scale1 1
Derived From Document IDE48EF6D7BBD746D525ABE31084E70BFB
Derived From Original Document IDE48EF6D7BBD746D525ABE31084E70BFB
Directoryoriginaldng
Document IDxmp.did:c4829856-b61c-6549-b4f4-7647f447f5c1
Exif Byte OrderBig-endian (Motorola, MM)Little-endian (Intel, II)
Exif Version0230
File Access Date/Time2014:12:17 21:04:41+01:002014:12:17 22:01:45+01:00
File Creation Date/Time2014:12:17 21:04:41+01:002014:12:17 22:01:45+01:00
File Modification Date/Time2014:12:16 18:28:46+01:00; 2014:12:17 22:18:03+01:002014:12:17 22:01:45+01:00
File Name201412161746-DSC_4789.nef; 201412161746-DSC_4789.xmp201412161746-DSC_4789.dng
File Size1510 bytes; 18 MB13 MB
File TypeNEF; XMPDNG
Focal Plane Resolution Unitcm
Focal Plane X Resolution2595.252136
Focal Plane Y Resolution2595.252136
Formatimage/dng
Forward Matrix 10.7755 0.0884 0.1003 0.2732 0.8748 -0.148 0.0234 -0.4317 1.2333
Forward Matrix 20.7477 0.2145 0.002 0.3005 0.9721 -0.2726 0.0232 -0.2404 1.0423
GPS Longitude17 deg 3' 47.88" E; 18 deg 3' 47.88"; 18 deg 3' 47.88" E18 deg 3' 47.88"; 18 deg 3' 47.88" E
GPS Position59 deg 19' 48.78" N, 17 deg 3' 47.88" E; 59 deg 19' 48.78" N, 18 deg 3' 47.88" E59 deg 19' 48.78" N, 18 deg 3' 47.88" E
History Actionderived, saved
History Changed/
History Instance IDxmp.iid:c4829856-b61c-6549-b4f4-7647f447f5c1
History Parametersconverted from image/x-nikon-nef to image/dng, saved to new location
History Software AgentAdobe DNG Converter 8.7 (Windows)
History When2014:12:17 22:01:45+01:00
Image DescriptionDescription of image in XMP
Image Height120; 4012170; 4012; 681
Image Number49441
Image Size6080x40126034x4012
Image Width160; 60801024; 256; 6034
Instance IDxmp.iid:c4829856-b61c-6549-b4f4-7647f447f5c1
Jpg From Raw(Binary data 992771 bytes, use -b option to extract)
Jpg From Raw Length992771
Jpg From Raw Start3900
Lens35mm f/1.8; 35mm f/1.8 G35.0 mm f/1.8; 35mm f/1.8; 35mm f/1.8 G
Lens IDAF-S DX Nikkor 35mm f/1.8G159; AF-S DX Nikkor 35mm f/1.8G
Lens Info35mm f/1.8
Lens Model35.0 mm f/1.8
Linear Response Limit1
Linearization Table(Binary data 3368 bytes, use -b option to extract)
MIME Typeapplication/rdf+xml; image/x-nikon-nefimage/x-adobe-dng
Metadata Date2014:12:17 22:01:45+01:00
Modify Date2014:12:16 17:46:00; 2014:12:16 17:46:00+01:00; 2014:12:16 17:46:00.202014:12:17 22:01:45; 2014:12:17 22:01:45+01:00
New Raw Image Digest55f718ca970b93121f35cbdefe363128
Noise Profile3.91012436102846e-005 7.43124960486706e-008 3.75753414206149e-005 6.40769485919105e-008 3.84237430380713e-005 6.43796376659275e-008
Original Document IDE48EF6D7BBD746D525ABE31084E70BFB
Original Raw File Name201412161746-DSC_4789.NEF
Other Image(Binary data 782826 bytes, use -b option to extract)
Other Image Length782826
Other Image Start997016
Photometric InterpretationColor Filter Array; RGBColor Filter Array; RGB; YCbCr
Preview Application NameAdobe DNG Converter
Preview Application Version8.7
Preview Color Space2
Preview Date Time2014:12:17 22:01:44+01:00
Preview Image(Binary data 115619 bytes, use -b option to extract)(Binary data 115619 bytes, use -b option to extract); (Binary data 29764 bytes, use -b option to extract)
Preview Image Length115619115619; 29764
Preview Image Start180231229926; 402856
Preview Settings Digesta3d70aa1b6a6c4813bc5de69ad6fc4ef
Profile Calibration Sigcom.adobe
Profile CopyrightCopyright 2012 Adobe Systems, Inc.
Profile Embed PolicyAllow Copying
Profile Hue Sat Map Data 1(Binary data 137936 bytes, use -b option to extract)
Profile Hue Sat Map Data 2(Binary data 138217 bytes, use -b option to extract)
Profile Hue Sat Map Dims90 30 1
Profile Look Table Data(Binary data 89143 bytes, use -b option to extract)
Profile Look Table Dims36 8 16
Profile NameAdobe Standard
Raw Data Unique ID5CB58B75E05DB5B1788E564B00000000
Reference Black White0 255 0 255 0 2550 255 128 255 128 255
Rows Per Strip120; 4012170; 681
Shadow Scale1
Shutter Speed Value0.4
SoftwareVer.1.00Adobe DNG Converter 8.7 (Windows)
Strip Byte Counts16525920; 57600130560
Strip Offsets18444106; 1918186272296
Sub Sec Time20
Sub Sec Time Digitized20
Sub Sec Time Original20
TIFF-EP Standard ID1 0 0 0
Tile Byte Counts(Binary data 2303 bytes, use -b option to extract)
Tile Length256
Tile Offsets(Binary data 3161 bytes, use -b option to extract)
Tile Width256
Unique Camera ModelNikon D3200
User Comment
White Level3880
XMP ToolkitImage::ExifTool 9.78Adobe XMP Core 5.6-c011 79.156380, 2014/05/21-23:38:37
Y Cb Cr Coefficients0.299 0.587 0.114
Y Cb Cr Sub SamplingYCbCr4:2:0 (2 2)

Footnotes