NEF Compression
Prepared 2006-03-19 by Bill Claff
Updated 2021-01-28
Image data in Nikon NEF files can be stored compressed or
uncompressed.
With the exception of the D1 all Nikon DSLRs offer compressed NEF.
Some Nikon DSLR models only offer compressed NEF while others offer both
compressed and uncompressed.
When both are available the question arises whether to choose compressed or
uncompressed NEF.
As we will see below the image data is typically compressed twice.
In the following table compression means the first compression step; the second
compression step is always loss‑less.
Some Nikon DSLR models offer lossless compression that is accomplished by
skipping the encoding table..
The following table summarizes the Nikon DSLRs NEF compression options:
Model |
NEF |
Encoding |
First |
D1 |
Uncompressed |
n/a |
|
D100 |
Both |
107 |
|
D1H |
Both |
107 |
|
D1X |
Both |
107 |
|
D70/D70s |
Compressed |
216 |
|
D40/D40x |
Compressed |
216 |
|
D50 |
Compressed |
216 |
|
D60 |
Compressed |
216 |
|
D80 |
Compressed |
216 |
|
D3000 |
Compressed |
216 |
|
D90 |
Compressed |
114 |
|
D3100/D3200/D3300 |
Compressed |
114 |
|
D5000 |
Compressed |
114 |
|
1 J1 |
Compressed |
114 |
|
1 V1 |
Compressed |
114 |
|
D2H/D2Hs |
Both |
216 |
|
D2X/D2Xs |
Both |
216 |
|
D200 |
Both |
216 |
|
D5100/D5200/Coolpix A |
Compressed |
450 |
|
D300/D300S/D3/D700 @12-bit |
Both |
240 |
|
D300/D300S/D3/D700 @14-bit |
Both |
640 |
|
D5300 @12-bit |
Compressed |
114 |
|
D5300 @14-bit |
Compressed |
450 |
|
D500/D600/D610/D7000/D7100/D7500 @12-bit |
Both |
114 |
|
D500/D600/D610/D7000/D7100/D7500 @14-bit |
Both |
450 |
|
D3S/D3X/D4/D800/D800E/D850/Df @12-bit |
Both |
114 |
|
D3S/D3X/D4/D800/D800E/D850/Df @14-bit |
Both |
450 |
|
D7200/D750/D810 @12-bit |
Both |
400 |
|
D7200/D750/D810 @14-bit |
Both |
1552 |
|
D5500/D5600 @12-bit |
Compressed |
400 |
|
D5500/D5600 @14-bit |
Compressed |
1552 |
|
D780 @12-bit |
Compressed |
401 |
|
D780 @14-bit |
Compressed |
1601 |
|
Z 6/Z 7 @12-bit |
Both |
401 |
|
Z 6/Z 7 @14-bit |
Both |
1601 |
|
Z50 @12-bit |
Lossless |
n/a |
|
Z50 @14-bit |
Lossless |
n/a |
|
D810A @12-bit |
Both |
? |
? |
D801A @14-bit |
Both |
? |
? |
The hyperlinks point to text files with the encoding values for those readers who are interested in performing their own research. (2) indicates 2nd version.
(? indicated data that has not been collected yet.)
First missing value is the point at which encoding truly begins.
Raw image data is compressed by using a lossy encoding followed by non‑adaptive Huffman compression.
During encoding the distinct values from the Analog to Digital Converter (ADC) are reduced to either 567, 683, 689, 769, 1025, 2753, 3073 or 4097 depending on the camera model and bit depth.
The encoding tables are stored in the NEF file along with the encoded/compressed data.
Here is a plot of the Unencoded (in Analog to Digital Units or ADUs) versus Encoded values for the 683 value table (the other tables are very similar):
The black line on this chart indicates the Nikon 683 value
table.
The red line indicates the values that correspond to CIE Lightness.
Clearly the Nikon encoding makes the Encoded value very much like perceptual Lightness.
In other words, since the human visual system doesn’t distinguish bright values as well as darker values; there is no need to keep as much precision in the highlight data.
Although the design is imperfect, in this author’s opinion;
the result is quite good and deserves the moniker “visually lossless”.
However, if you will be post processing images with a great deal of highlight
content then you may want to choose uncompressed NEF rather than compressed NEF
to reduce any chance of posterization.