# Everything you always wanted to know about desaturation (but weren't bored enough to ask)

February 5, 2009 in

I took this photo the other morning, looking south down 2nd Avenue.  It has a tilt/shift effect applied, which fools the brain into thinking it is looking at something very small - a scale model of a city scene, for example.  Click the image to see a full version, which conveys the effect better.

I keyed up the saturation as well, which invokes more of a "toy model" feel, and as I was playing with it I thought the picture might also be interesting in black and white.  (Warning... if you don't want to hear about some behind the scenes image processing math [there's math in art?!] you should probably skip below and just click the pictures.)

The easiest way to get a black and white image is to use Photoshop's desaturate command.  This strips all color information out of the image, leaving only a grayscale residual.  However, I find that the desaturate operation to be unsatisfactory. This is because desaturate converts color information to grayscale information by taking an average.   Each pixel in an RGB color image is represented by a 3x1 vector, generally on a 0-255 scale, with each entry of the vector corresponding to the intensity of red, green, and blue, respectively. So [255 0 0] represents pure red; [0 255 0] represents pure green; [0 0 255] represents pure blue.  These vectors are orthagonal and so span the entire color space, meaning any imaginable color can be created as some linear combination thereof.   The desaturate command converts these three-dimensional vectors to a one-dimensional grayscale vector by averaging the color information, perhaps using the root mean square.  In other words:

This quickly causes a problem -- the grayscale values of pure red, pure green, and pure blue are all the same!  Moreover, there are practically infinitely other colors who share the same grayscale levels -- this red [200 25 30] and this green [30 200 25] among them (both would be [177.7] in my scheme).    Only pure white [255 255 255] and pure black [0 0 0] are uniquely defined as grayscale vectors [255] and [0], respectively.

That's not how we see the world.  A red and a blue look dramatically different even if they happen to have the same average color content -- blues typically look "darker" than reds, which are typically "brighter" or more striking, despite the relative brightness of the tones.  Unfortunately, the desaturate command simply flattens the extra color information, discarding it.

There is no perfect solution -- any conversion from color to black and white involves projecting a 3D vector to a 1D space, and there must be information loss as a consequence.  However, it is up to the artist to make a decision about the mapping function that performs that conversion.

Interestingly, this is one of the areas where digital photo manipulation draws inspiration from the analog world of film. Anyone who has taken a black and white [film] photo class will remember shooting with a yellow filter attached to their lens. Why?  Black and white film performs the same root mean square desaturation that I described above; this causes artificats like those I mentioned previously, such as blues which we perceive as "darker" appearing brighter. A yellow filter skews the color information so that blues appear darker on the film, and yellows/oranges/reds appear somewhat lighter. This is most noticable when you take a picture of the sky on a sunny day -- without the yellow filter, the blue sky will be white due to the intensity of the light.

Yellow is a nice choice because it's effect is subtle - it works most dramatically on colors in the middle of the spectrum, and the ends (reds and blues) are only slightly affected.  Red and blue filters, on the other hand, have much more dramatic effects.  As you might intuit, red filters result in colors from the blue end of the spectrum becoming extra dark (think of how a red object looks through a red filter - it stays red - versus how a blue object looks - it turns black); blue filters work the opposite way.

Many Photoshop users apply these sorts of effects using the curves pallate (and more recently, Adobe has included virtual black and white filters directly). The effect can be much more satisfying than a simple desaturate, which seems boring by comparison.  Like any manipulation it can also be extremely dramatic - perhaps to a fault - depending on the artist's application of the tool.

Here is the same tilt/shift picture after applying a virtual red filter (left) and blue filter (right).  No other changes have been made -- click the images to enlarge.

The red filter cuts through the blue haze at the top and leaves the foreground well lit; the blue filter renders the haze lightly and shadows the generally red-tinted foreground.  Both add significant contrast.

Which do you prefer?