Linear Color Space Editing
In my last post I said that gamma adjusted color spaces are bad for image editing.
First off, I am one of those that saw the light reading http://www.aim-dtp.net/index.htm and hasn't recovered yet.
Indeed the entire LightZone project started from the "discovery" that linear color space editing is the thing to do.
I have learned recently that the internet has been a hot place for a while, when the gamma proponents/opponents have been flaming each other for a while.
I don't wish to reheat old flames, but I have to say something all the same.
Gamma encoding has its roots far back in the early days of TV broadcast when the industry had to produce reasonably priced TV sets: to lower costs signal processing in TV receivers should be minimal.
The CRT tube has a non linear transfer function that needs to be compensated to display images properly. To avoid processing the image in the receiver the signal was pre-processed at broadcast time to compensate for the CRT transfer function. This seems to have been the birthplace for the gamma encoding we have in images today:
output_intensity = input_intensity ^ gamma
There actually seems to be a good reason why digital images are gamma encoded. Eight bits per color is not a lot and without gamma encoding for images it would be easy to have banding artifacts in color images.
Gamma encoding seems to be an effective way of performing a perceptually adjusted lossy image compression, using relatively more bits to represent darker parts of the image than for the lighter ones. This is convenient because the eye has a logarithmic sensitivity scale and it sees banding more in the shadows than in the highlights.
With modern computers with lots of RAM and fast CPUs we can afford processing images with 16 bits of precision per channel, which is plenty of resolution for all practical purposes.
At this point there is no excuse anymore to edit images in gamma space, Timo Autiokari has expounded in detail the errors induced by gamma editing, please take a look at his very interesting site:
The problem of linear editing is that tools like Photoshop have been designed with gamma adjusted images in mind. Linear encoded images have most of the "stuff" in the low pixel numeric values and very little in the higher values.
Using curves and histograms in Photoshop with a linear color space is a daunting task. All the information is bunched up in the left side of the histogram making it very hard to evaluate the characteristics of the image. Similarly all the curve work has to be done in a tiny region close to the origin of the curves tool. Very impractical.
In LightZone we use different tools from Curves and Histograms: the Zone Mapper and the Zone Finder. These tools are well adapted to working in a linear color space because they present the information too the user in a logarithmic scale, thereby spreading the intensity information across a large range of values which is using effectively the computer screen real estate and allows to conveniently adjust images on a scale that is natural for the eye.