Saturday, June 22, 2013

Wishes Granted!

A WHILE BACK, I wrote two articles listing things that I’d like to see in some future version of Photoshop:
Now some of the things I wrote are rather confused or unclear, but I did see a real need for them at the time, such as:
Each color channel has a maximum value of 255, a minimum value of 0, and we can use only integer steps between: 1, 2, 3, and so forth, with no intermediate values. This lack of precision is of little consequence to most users, and if you do need greater precision — for example, if you are applying severe curves to your image — then certainly you can use 16 bit mode (as I do) to increase the number of possible values. This extra precision helps avoid digital processing artifacts such as banding, and also lets you get better shadow detail…

But that isn't good enough. I'd like to see fractional RGB numbers. I want RGB values greater than 255. I want negative RGB numbers. But this is madness! You cannot display an image with RGB values greater than 255! And what on earth are negative RGB values? Those are clearly impossible, there is no such thing as negative light!
OK, for a final image, it needs to be in some specific, bounded color space that can be reliably displayed or printed on various devices, and for the time being, the best color space for images is usually sRGB, at 8 bits per color channel, using the JPEG file format, since those standards are supported by nearly all computer monitors and desktop printers. But when you are processing an image, there very often is a temporary need for values that exceed the bounds of any particular color space:
For example, when I apply a severe curve to an image, anything that ought to go over 255 is set to 255, and so we lose information and image detail. However, if its value ought to be 300, I want it to be 300, even though it is out of the gamut for the time being. If I tell Photoshop to make an image twice as bright, I want the entire image to be twice as bright, without worrying about losing highlight detail. I will deal with the gamut when I need to deal with it, which is when I’m preparing the final image for print or web display…

This brings us to negative RGB numbers. These in fact can represent real colors. For example, if you work in a narrow-gamut color space similar to sRGB, and you want to represent a real color outside of its gamut, you can mathematically represent this if you are willing to allow at least one RGB number which is negative or greater than 255. So a negative RGB does not mean negative light, but rather that it is merely an out-of-gamut condition. If we are allowed to use negative numbers — and numbers greater than 255 — then we will be able to represent all colors while still using a system that is otherwise identical to our narrow-gamut color system. This system will remain relative to a particular gamut, while not being limited to that gamut.
There were a number of other things that I wished for, including:
3. Photoshop does not resize images well, and often generates interference patterns. Lots of research has been done on these kinds of algorithms, and it would be good to see these better solutions in Photoshop…

5. When you use curves in RGB, you can either do it with the Normal blending mode, which typically causes an increase in saturation, or you can do it with Luminosity blending, which decreases saturation. How about a simple method which does neither? I just want the tonality to change, not the basic coloration…

8. I’ve noticed that there is a distinction between chroma, colorfulness, and saturation; not really sure how or what Photoshop does. A solid colorimetric model would be useful…
Now for the last month and a half or so, I’ve been working on my next book, which is due out this fall, and so I haven’t been posting here since I was rather busy. But during my photo processing, I’ve ran into problems related to all of these wishes mentioned above. I was working with scenes that had tremendous dynamic range, and so I took multiple exposures — sometimes five separate images or more — and had to blend them together so as to create an attractive and plausible final image. The software I was using to blend together these images often would over- or under-expose my images, or would often create odd shifts in color, such as turning reds to orange and blues to purple.

I also had to add severe curves to images, do strong brightening of shadows and extreme pulling back of highlights, and all of these photos ultimately had to be converted to the CMYK color system so that they can be printed on commercial press.

I also had to use a good resizing algorithm that would retain image sharpness without aliasing artifacts. And so I used the comprehensive ImageMagick utility, as I had on my two previous books. Even though it is a difficult-to-use command line interface, my workflow is smooth, if a bit error-prone if I’m not careful. The particular algorithm I use seems to produce sharper image when downsizing an image greatly, reducing the need for additional sharpening as an image gets smaller.

With regards to image sharpening, this is best done on a linear image — that is, one where a gamma correction has not been applied —  but Photoshop only allows me to do this in a clumsy and unsatisfactory manner. I had to use at least 6 different sharpening methods because of one difficulty or another. By the way, I think sharpening is an important technique that can really use some more research.

Since my first book, I used the enfuse software package — which is another UNIX command-line utility — to blend together multiple exposures, but it was having trouble with the huge dynamic range of my subjects, far greater than what I had used before. Important, bright, saturated highlights were being overexposed, or my shadow tones were turned to pure black, often with strange artifacts. I also had severe color shifts. As this is a critical component to my workflow, I went to the product developers, who graciously helped me out with this, and even provided me with a new build that overcame some problems I was seeing.  As it turns out, I was using features that should not be used with images that have a gamma correction applied, and the new version supported images with gamma.  Also, the package can do blending of colors using the CIECAM02 color space — a model of color based on the properties of human color vision — which leads to more visually accurate results.

I use a number of camera RAW file converters, simply because each converter has its strengths and weaknesses, and some images — for whatever reason — fail to convert well with one package or another. As I was busy processing my photographs for the book, I found out that none of my RAW converters worked on some images, giving me unappealing photos:  extensive detail in the shadows or highlights were damaged no matter the setting, or colors were lost, or no adequate white balance could be achieved. It was a desperate situation, and I looked around for alternatives.

I rediscovered the Raw Therapee product. I downloaded it some years ago, but didn’t see much that interested me. But now, in my desperation, I needed something that would work, and so I got the latest version. Finding the user interface complex and not intuitive, I read the manual. As it turns out, many items on my wish lists are featured in this product, and it did what I needed it to do. Every problematic photo was processed easily and successfully by this product. Wishes granted.



At a bare minimum, I would like an image to plausibly look as I remember seeing the scene. Almost always I can see detail and saturated color in bright highlights, and I can see texture and color in almost the deepest of shadows in the real world. Granted, some scenes have so much dynamic range that some  sort of HDR photography is called for, or supplemental lighting, but sometimes I have problems photographing scenes with flat lighting; for example, brightly colored flowers often produce problems. For my book, I often had bright saturated red colors which rendered poorly, with the red colors rendering without much texture, or where they shifted to an orange color even though the white balance was adequate.

As mentioned, I would like an image to look as I remember seeing the scene, at least as a starting point in my processing. But this high expectation usually can’t be matched by standard camera JPEGs, and using RAW files is sometimes problematic as my experience with the various RAW converters demonstrates. Even if I do want to adjust the tonality of my final image for effect, I almost never want blown highlights and plugged shadows, but I find these defects even in scenes with flat lighting.

There is one critical step in RAW processing — either in the camera or on the computer — which can harm the final image.  No camera perceives colors like the human eye, and one way the camera approximates human color perception is via a blunt instrument: a color matrix is a transformation of the RAW pixels, where the various color channels are multiplied by factors and added and subtracted from each other to approximate visual colors: see the article Examples of Color Mixing for an example of this. This addition and subtraction can easily force pixels to be either zero or to 255, which causes loss of texture.  More complex way of converting the colors, using look-up tables (LUTs) or parametric curves, while giving more accurate color (up to a point), can harm an image in unpredictable ways, and may even put a cap on the quality of a conversion.

This color conversion is mainly done these days via ICC profiles, a series of standards promulgated by the International Color Consortium. Adobe, however, uses its own profiles for its products. Not all profiles are created equally, even if they are all theoretically for the sRGB standard. Some profiles generate more noise than others; some will frequently clip highlights or plug shadows.  For example, if you examine the blue color channel of a digital image, you might be dismayed as to how noisy it is; now part of this noise is simply due to the facts of digital capture, but the RAW conversion itself can generate large amounts of noise itself if a malformed profile is used, or if inadequate precision is used in the mathematics of the transform. You read about this phenomenon in the article ICC Color Space Profiles and Blue Channel “Noise”; here we see that “noise” can simply be artifacts of color conversion, which leads to loss of texture in the final image. I’ve seen these kind of artifacts in my own experience in RAW conversion.

RawTherapee uses high precision mathematics when converting a RAW file — it uses 32 bits per color channel as a standard, and it optionally can go to 64 bit per channel — and it attempts to use high-quality custom profiles for rendering the final image. It also allows unbounded calculations: even if an image is destined for the sRGB color space, if a particular pixel needs to go outside that color space temporarily, it will go outside, without being clipped. Enfuse also uses unbounded, high-precision mathematics for its calculations.

Like Enfuse, RawTherapee now optionally uses the comprehensive CIECAM02 color space, which allows for visually precise manipulation of color and tone levels. It separates color from tonality in a way much more satisfactorily than the RGB and Lab color spaces used in Photoshop.

It appears that most of my wishes have been granted in a way, although I must admit that these software packages lack the polish of expensive commercial software like Photoshop, and due to my time constraints, I have large gaps in my understanding of them and undoubtably are not using them optimally.



A while back, I decided that I was too concerned with camera gear and photographic technique, and that instead I needed to concentrate on more universal artistic concerns, such as composition, color, lighting, and mood. But it was precisely at that moment that a large number of technical roadblocks were placed in front of me, and I was forced to get an understanding of imaging technology before I could concentrate on to the other things. Ironic, yes? But this should be expected. Western culture, unfortunately, has developed an ‘art versus science’ mentality — and this disease is spreading to other cultures because it is thought to be progressive — but that was not always the case in the West. Rather, art and science are merely two aspects of the human person, and these ought to be joined together so as to produce fruitful offspring.

My concern with all this high technology was so that I could get pleasing final images, and my existing technology failed in that purpose. But high precision mathematics can lead to artistically precise images and unbounded calculations remove bounds from artistic intent. It is all a part of one process.