Home - Light Developer - 16bits & Linear editing

Light Developer chooses 16 bits per channel, which is in linear space, as its internal image formats.

Linear vs. Gamma

Many users know the name 'sRGB' and 'aRGB' as the color space applied on the photo. When consider a channel of 8 bits in sRGB (or aRGB ), which varied from 0-255, few users knows the answer of this question, which value represents the half energy of the white point (255)?

You may say 127 because it is half value of 255, but the true answer is around 190, (the exactly value depends on the colour space). Strange, isn't it? That is because the 8bits, 0-255 value, is calculated on a gamma-space, which is not linear. That means the value 255 does not represent double bright than the value 128, and the value 32 is not 1/4 bright of the value 127.

The gamma curve theory is based on responding of the human-eye. The following figure (Fig. 1) shows the different between linear and gamma space.Linear vs Gamma

You may have more questions, but in this article, it is not important why or how, but what effect it will bring to the image in the processing results.

Considering an operation that blends 2 pixels together, one is white (255), one is black (0). The result in gamma space is 127 as the middle value of the two inputs. In linear space, we get 1.0 and 0.0 for the inputs as float value. So the result is 0.5. After transforming from linear space to gamma space, we get 189 in sRGB space. The following figure on the right shows two results (Fig. 2).Blur comparasion

As in Figure 2, when blurring the pattern, which is constructed by white and black pixels, the linear space result is more accurate to the real feeling of human eye. If you look at the figure from a distance, with a calibrated monitor, you can see the fact clearly. Feel familiar with this? This is the standard way to calibrate the monitor's gamma value. So you can understand - running an operation like 'blur' in gamma space will bring a 'wrong' result. If you test other software by using this pattern, you can find that most of them are running under gamma space.

So, any processing including a 'blending' operation inside may lead to a wrong result if the gamma space value is used. Let's think about another example, the RGB to grayscale processing. The simple formula is:

L = R * 0.3 + G*0.6 + B * 0.1
Where L is the grayscale outputting, R,G, B are the Red, the Green and the Blue channel values.Difference on grayscale

In theory, these R, G, B values represent the real energy power that means it should be calculated in linear space. But, most software does it in gamma space and gets wrong outputting as following sample.(Fig. 3) This is a repeatable and simple experiment that tests any image software and you can do it yourself. And then, you will find most popular software cannot output the good result of grayscale like linear space does. As a professional photographer, this is a serious problem.

In conclusion, you can benefit from linear space by its accuracy in processing where blending is involved. Gamma space still has its advantages too. It brings better results and is easy to understand on traditional functions like 'curve', 'auto level', etc. To achieve the best balance, in Light Developer, gamma space is simulated or optional when running those functions; except when linear space is used in the algorithms in default.

Editing in 16bits per channel

Most digital cameras support RAW format and many photographers select RAW as their preference. Compared to a JPEG file, RAW format can keep the original data from the camera sensor, which outputs 12 bits per channel normally.

For 8 bits format like JPEG, it contains 256 scales of changing. For a long time, photo editing software worked in 8-bits gamma space like JPEG system does. 8 bits is enough for most of the processing.

As RAW format becomes popular, 8 bits is not enough to keep all information of the 12 bits inputs. So the software must be upgraded to 16 bits (2 bytes) channel to adapt. The advantage of 16bits per channel is obvious: It keeps all details and provides more flexibility in editing the photo.

Based on the above reasons, Light Developer chooses 16 bits per channel, which is in linear space, as its internal image formats.