Pixels and subpixels
Once I wondered: ‘Why do my Nikon D700 RAW files weigh so little?’. In search of an answer, I found very interesting information.
So, when shooting, I sometimes use the RAW file format, (in Nikon it is called NEF – Nikon Electronic Format – Nikon electronic file format). Nikon’s RAW files have certain settings, I usually use 14-bit color depth with no loss or no compression at all. In general, NEF files with 14-bit color depth and without compression weigh about 24.4MB. In the image below, I showed the size of my files in bytes.As you can see, the files are almost the same size. Take, for example, the ARK-4820.NEF file, its weight is 25,621,760 bytes, or 24.4 MB. Bytes in Megabytes are translated very simply:
25,624,760 / 1,048,576 = 24.4
I want to note that the different weight of RAW (NEF) files is due to the fact that they carry not only useful “raw” information, but also a small picture preview, as well as an EXIF data module. Image preview is used to quickly view the image on the camera monitor. When browsing the camera does not require loading a heavy 25 MB file, but simply pulls out a thumbnail preview and shows it on its display. These pictures are most likely encoded using JPEG, and the JPEG algorithm is very flexible and for each miniature taken requires a different amount of information to be stored.
A 14-bit color depth means that each of the three primary colors is encoded with 14 bits of memory. For example, by pressing the ‘question mark’ button on the corresponding menu item of the Nikon D700 camera, you can read the following:
‘NEF (RAW) images are recorded in 14-bit color depth (16384 levels). At the same time, files are larger and more accurate transfer of shades ’
The color is formed by mixing the three basic shades – red R (Red), blue B (Blue), green G (Green). Thus, if we use 14-bit color depth, we can get any of 4,398,046,511,104 colors. (any of four billion three hundred ninety eight billion forty six million five hundred eleven thousand one hundred four flowers).
It’s easy to count: 16384 (R) * 16384 (G) * 16384 (B)
In fact, 4 billion is much more than necessary, for normal color reproduction, such a large stock of colors is used for easy image editing. And to encode one ‘pixel’ image in this way, 42 bits of memory are required:
14 bits R + 14 bits G + 14 bits B = 42 bits
My Nikon D700 produces maximum quality pictures of 4256 by 2832 pixels, which gives exactly 12,052,992 pixels (about 12 million pixels, or just 12 MP). If you encode images from my Nikon D700, without using compression and data compression algorithms, and with 14-bit color depth, you will need to use 506,225,664 information bits (42 bits / pixel multiplied by 12,052,992 pixels). This is equal to 63 278 208 bytes, or 60.3 MB of memory.
Question: why according to calculations it takes about 60 MB of memory for one image, but in fact I only get files at 24.4 MB? The secret is that the original RAW file stores not хран real ’pixels, but information about the Nikon D700 CMOS subpixels.
That is, the instruction says about ‘effective pixels and про total number’ of pixels. The number of effective pixel counts is very simple, just take JPEG Fine and take a snapshot of 4256 by 2832 pixels, which is equal to that described earlier than 12,052,992 pixels. If we round it up, we will get the statement stated in instruction 12.1 MP. But what is this ‘total number of pixels’, which is almost one million (1MP) more (12.87 MP)?
To understand this, it is enough to show what the Nikon D700’s photosensitive sensor looks like.
If you look closely, then the Bayer matrix does not create any ‘multi-color’ image. The matrix simply registers green, red and blue dots, with more than twice the green dots than the red or blue dots.
In fact, this matrix is not composed of pixels (‘in the usual sense’), but of sub-pixels or recorder cells. Usually it is implied that a pixel is a dot of an image representing any color. On the Nikon D700 CMOS sensor, there are only sub-pixels that are responsible only for the three basic shades, on the basis of which “true”, “multicolor” pixels are formed. The Nikon D700 matrix has about 12,870,000 such sub-pixels; in the manual, these pixels are called “efficient”.
There are no ‘real’ 12 MP on the Nikon D700 sensor. And the 12 MP, which we see in the final image, is the result of hard mathematical interpolation of 12.87 Mega sub-pixels!