NEF file types and sizes: bit depth and compression

WayneF

Senior Member
OK now that I've made this tough decision, I've got a question for the bigger brains here. Now having switched to 14-bit raw uncompressed, how does that help when converting it to 8-bit jpeg after post processing? What have I gained when I end up at 8-bit jpeg anyway? I know there is a logical answer that make this all make sense, but I'm not seeing it.

I'm not sure 14 bits will help much, but it won't hurt. But 12 bits is a good basic plan for scanners and cameras.

8 bits (256 colors) is plenty for our human eye. Our image is very likely going to end up in an 8 bit file, but regardless, of course we can only show it on our 8 bit monitor, or print it on a 8 bit printer. Without some very heroic special equipment (it can be bought, LucasArts uses it for movies), there is no way we can even look at more than 8 bits, much less see it. 12 bits can hold greater dynamic range, and can differentiate more individual colors, but we can never see any of that. We have 8 bit display devices.

But scanners and cameras do have 12 bits or more internally, because it helps on the early work, that which involves drastic tonal shifts. White Balance and Gamma (and sometimes exposure) are rather drastic tonal shifts, and necessary. But, this is only done one time. Then we can do 8 bits.

This won't help, but you can think of 8 bits as 256 larger buckets, and 12 bits as 4096 smaller buckets. As we shift it drastically up a tone curve, small bucket values probably end up in the right new small bucket, but the 8 bit values get dumped into another larger approximation bucket. The color shift is not as precise. And FWIW, color is detail, how we see detail.

This 12 bit benefit is subtle, and difficult to show, but 12 bits is not expensive, and it is better, so why not? It does have more range than 8 bit JPG. Many scanners are 16 bits now, not because it is better, but because it has become just as inexpensive to do, and it markets well. Our camera Raw files are output as 12 bits (which is then stored in computer 16 bit words), and we do this early shift work, and then output it for final uses as 8 bits.

All of this is unimportant for routine editing, but more of a big deal for the extreme tonal shifts, like white balance and gamma, done once.

So then, after white balance and gamma shifts (and exposure) are tonal shifts done as 12 bits, then we're done, and we can further edit this 8 bit data any time, for example, resampling, sharpening, cropping, etc.... which are not tonal shifts, and 8 bits is fine. However, Raw stores the original 12 bit data, and we do go back to that for any additional work (because it is lossless editing). We could change our mind about white balance, but otherwise, our drastic work has already been done now.
 
Last edited:

Bill16

Senior Member
Well I think I understood part of this buddy, but the biggest thing that stood out in it that helps is that what I did won't hurt! Lol ;)

All I know is that my D300 offers this option for 14-bit and even uncompressed if I want it. So as long as it doesn't hurt, I'll give it a go.

I already found out that uncompressed works better for me! :) My laptop isn't having all the trouble it was having at times getting the photo opened in post processing, now that it isn't compressed. Woohoo! So far so good!lol ;)

I'm not sure 14 bits will help much, but it won't hurt. But 12 bits is a good basic plan for scanners and cameras.

8 bits (256 colors) is plenty for our human eye. Our image is very likely going to end up in an 8 bit file, but regardless, of course we can only show it on our 8 bit monitor, or print it on a 8 bit printer. Without some very heroic special equipment (it can be bought, LucasArts uses it for movies), there is no way we can even look at more than 8 bits, much less see it. 12 bits can hold greater dynamic range, and can differentiate more individual colors, but we can never see any of that. We have 8 bit display devices.

But scanners and cameras do have 12 bits or more internally, because it helps on the early work, that which involves drastic tonal shifts. White Balance and Gamma (and sometimes exposure) are rather drastic tonal shifts, and necessary. But, this is only done one time. Then we can do 8 bits.

This won't help, but you can think of 8 bits as 256 larger buckets, and 12 bits as 4096 smaller buckets. As we shift it drastically up a tone curve, small bucket values probably end up in the right new small bucket, but the 8 bit values get dumped into another larger approximation bucket. The color shift is not as precise. And FWIW, color is detail, how we see detail.

This 12 bit benefit is subtle, and difficult to show, but 12 bits is not expensive, and it is better, so why not? It does have more range than 8 bit JPG. Many scanners are 16 bits now, not because it is better, but because it has become just as inexpensive to do, and it markets well. Our camera Raw files are output as 12 bits (which is then stored in computer 16 bit words), and we do this early shift work, and then output it for final uses as 8 bits.

All of this is unimportant for routine editing, but more of a big deal for the extreme tonal shifts, like white balance and gamma, done once.

So then, after white balance and gamma shifts (and exposure) are tonal shifts done as 12 bits, then we're done, and we can further edit this 8 bit data any time, for example, resampling, sharpening, cropping, etc.... which are not tonal shifts, and 8 bits is fine. However, Raw stores the original 12 bit data, and we do go back to that for any additional work. We could change our mind about white balance, but otherwise, our drastic work has already been done now.
 

WayneF

Senior Member
Well I think I understood part of this buddy, but the biggest thing that stood out in it that helps is that what I did won't hurt! Lol ;)

All I know is that my D300 offers this option for 14-bit and even uncompressed if I want it. So as long as it doesn't hurt, I'll give it a go.

I already found out that uncompressed works better for me! :) My laptop isn't having all the trouble it was having at times getting the photo opened in post processing, now that it isn't compressed. Woohoo! So far so good!lol ;)

I've never tried the uncompressed file, but I did buy a faster computer for Raw. :) Compression is a computer operation on every pixel, it can take more time. And the megapixels are growing too.

All this stuff has been endlessly debated, Nikon NEF compression for several years, and 8/16 bit editing for much longer. Seemingly not so much anymore, I think everyone is tired of it. :)

My own opinion is that the consensus is that there is very little quality difference between Nikon Compressed and Uncompressed NEF files, and in 12 and 14 bit data files. I can't say I have ever seen it (lossy and lossless), so I don't worry with it. Others seem to think "What if it might matter" and they plan accordingly. Compression is not necessarily a bad word, and the lossy NEF compression is NOTHING like JPG, better than even the better JPG. Raw is really important of course (for the benefits it offers), but I am happy with 12 bit lossy NEF files.

The 16 bit thing was back in the later 1980s, when scanners became inexpensive, and everyone had one like they have digital cameras today. It is hard to show clear evidence, but I do think 16 bit editing is theoretically good for the extreme tonal shifts, without any reason to risk doing without it. Scanners and cameras all do it, and Raw software of course. But after we have done that step, 8 bits is plenty. We have no way to see more.
 
Last edited:

Bill16

Senior Member
OK next question! Lol I also have the option to shoot tiff rgb at about 35mbs and the raw 14-bit uncompressed files are only 25mbs. So does that mean the tiff files are 16-bit?

Here are two shots I took for the heck of it. One shot started off Raw and the other as Tiff, unfortunately I couldn't upload the Tiff with just resizing. So they are both now jpg.


dsc_8089.jpg


dsc_80882.jpg
 

WayneF

Senior Member
OK next question! Lol I also have the option to shoot tiff rgb at about 35mbs and the raw 14-bit uncompressed files are only 25mbs. So does that mean the tiff files are 16-bit?

No, the TIF files are 8 bit. 12 megapixels, 8 bits is 3 bytes per pixel, file size is about 36 MB (uncompressed).

TIF file is 8x3 = 24 bits per pixel (3 bytes). Raw files are 12 bits per pixel (1.5 bytes).

I think there is no point of outputting TIF files. They are RGB, they do have white balance and gamma in them (done as 12 bits in the camera), but then any changes would NOT be lossless editing. At any change, you would be shifting tones back and forth then (not a factor for Raw files). Basically, the TIF is the same as JPG files, but without any JPG artifacts.

If you did want a TIF file, you can get one from Raw, via lossless editing.
 

Bill16

Senior Member
Cool! Thank you very much buddy! I really appreciate your help my friend! :D

No, the TIF files are 8 bit. 12 megapixels, 8 bits is 3 bytes per pixel, file size is about 36 MB (uncompressed).

TIF file is 8x3 = 24 bits per pixel (3 bytes). Raw files are 12 bits per pixel (1.5 bytes).

I think there is no point of outputting TIF files. They are RGB, they do have white balance and gamma in them (done as 12 bits in the camera), but then any changes would NOT be lossless editing. At any change, you would be shifting tones back and forth then (not a factor for Raw files). Basically, the TIF is the same as JPG files, but without any JPG artifacts.

If you did want a TIF file, you can get one from Raw, via lossless editing.
 

aroy

Senior Member
8 bit files have 256 levels per colour
12 bit files have around 4K levels per colour
14 bit files have around 16K levels per colour
16 bit files have around 64K levels per colour
So the more bits the smoother the colour transition (subtler the shades). When you process the images and convert them to 8 bit jpeg, you may do either of these operations
. Take the top 8 bits of data
. Map the 12/14 bits to 8 bits linearly
. Map the 12/14 bits to 8 bits non linearly, using a response curve. Here you usually expand the lower end to bring the shadows out and compress the high end, that is tone down the highlights.

What ever you do, the normal monitors and printers rarely display more than 8 bit per colour, while RAW has at least 12 bits.

Computer formats usually have data in 1 byte (8 bit) multiples, so when you say TIFF 16 it means each colour has 16 bits, and if there are 3 colours then each pixels is now 3x16=48 bits - 6 bytes. So a 24MP image becomes 144MB in TIFF 16, while a 36MP would bloat up to 216MB. This is where compression comes in. Non destructive compression can reduce the images size upto 6 times, while destructive compression can go all the way upto 50 times. The current jpeg format is 8 bits per colour, but jpeg2000 used for satellite images can go upto 16 bits.
 

J-see

Senior Member
No, the TIF files are 8 bit. 12 megapixels, 8 bits is 3 bytes per pixel, file size is about 36 MB (uncompressed).

TIF file is 8x3 = 24 bits per pixel (3 bytes). Raw files are 12 bits per pixel (1.5 bytes).

I think there is no point of outputting TIF files. They are RGB, they do have white balance and gamma in them (done as 12 bits in the camera), but then any changes would NOT be lossless editing. At any change, you would be shifting tones back and forth then (not a factor for Raw files). Basically, the TIF is the same as JPG files, but without any JPG artifacts.

If you did want a TIF file, you can get one from Raw, via lossless editing.

But you can save as 16bit Tiff (12 really) which is what I do since my PS doesn't do RAW. Working with them hardly takes more time and effort these days but please tell me I'm not doing exercises in futility.
 

J-see

Senior Member
Since we're talking RAW and such, does anyone else that uses Lightroom have those occasionally strange quirks when handling NEF files? Like this red blotch at the bottom that only shows in LR but not in the final image.

glitch.jpg

I'm investing some more time in LR since I can directly export their RAW to my PS including camera settings but those occasional quirks somewhat ruin my faith in the program.
 

J-see

Senior Member
Thank you, now I know what it is, I solved it by turning off the clipping indicator. I had no idea why some imported images showed those red and blue blotches.

The more I use Lightroom, the more charming it becomes. It irked me at first -old dogs and old tricks- but it sure is handy once you figured out how it works.
 

WayneF

Senior Member
But you can save as 16bit Tiff (12 really) which is what I do since my PS doesn't do RAW. Working with them hardly takes more time and effort these days but please tell me I'm not doing exercises in futility.

It is still not lossless editing though, not like Raw. In TIF or JPG, when you edit tones, you shift the tones in the only copy you have. In Raw, you merely save the edit instruction and keep the original image. and only shift tones the one final time when you output the final JPG. When you change the Raw edit, you merely replace the instruction, you don't shift the tones back and forth. The original is always available.


Since we're talking RAW and such, does anyone else that uses Lightroom have those occasionally strange quirks when handling NEF files? Like this red blotch at the bottom that only shows in LR but not in the final image.

View attachment 113135

That is the light room display of your clipped highlights. It is not in the image, just the display. Click the little upper right button in the histogram to turn it on or off.
 

aroy

Senior Member
It is still not lossless editing though, not like Raw. In TIF or JPG, when you edit tones, you shift the tones in the only copy you have. In Raw, you merely save the edit instruction and keep the original image. and only shift tones the one final time when you output the final JPG. When you change the Raw edit, you merely replace the instruction, you don't shift the tones back and forth. The original is always available.
........
It depends on the software.

Some implement the changes on the file while saving, so that you can never get the original file, unless you have a copy.

Others keep the list of changes you have made in a separate file (sidecar file). Every time you open the image all the changes listed in the sidecar file are carried out. Your original file remains as it was.

The advantage of 16bit file is that you have a larger range of intensities to play with.
 

WayneF

Senior Member
It depends on the software.

Some implement the changes on the file while saving, so that you can never get the original file, unless you have a copy.

Others keep the list of changes you have made in a separate file (sidecar file). Every time you open the image all the changes listed in the sidecar file are carried out. Your original file remains as it was.

The advantage of 16bit file is that you have a larger range of intensities to play with.


That is true, Adobe Raw will also do lossless editing on JPG and TIF files It saves these edit instructions somewhere in the file instead of changing the file data. And like Raw, you still have to output a new JPG or TIF for other programs to see the edit, otherwise, other programs still only show the original JPG or TIF. If the TIF was 16 bits, then yes it is still 16 bits.

In the case of editing JPG from a compact camera, this is a big plus. Better tools, and only the original and final set of JPG artifacts (and there is no Raw Other Choice).

In THIS case of the TIF that came from Raw, it seems pointless. There is another choice (the original Raw), and regular tonal work could be using the Original Raw for this. I realize there are lots of special effects possible in Photoshop though.

I suppose the TIF idea is to do additional editing in Photoshop, stuff Raw won't do. But that might not be the tonal shifting work that Raw CAN DO. It is certainly not lossless edits then. Photoshop is not lossless edit - Edits change the data of the only RGB version you have, actually shifting tones back and forth. I suppose one can always discard the TIF and go back to the original Raw file then, that could be lossless. :) Different strokes for different folks.
 
Last edited:
Top