Wednesday, November 30, 2011

Photoshop Wishlist #2


  1. When I apply noise reduction in Photoshop — no matter what technique I use — the apparent saturation decreases. Why is this? How can this be avoided? I don’t want to merely add saturation back in, but avoid it. I’ve noticed the same thing with small-sensor digital cameras, those that do lots of noise reduction in-camera.
  2. Are there any good techniques to get rid of the brightly colored noise found along edges? This is due to demosaicing the Bayer array of the sensor. Eliminating this noise usually leads to desaturation of the good pixels.
  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. Also, fractal resizing has many benefits and would be valuable to have also.
  4. I’d like to be able to fully edit ICC profiles in Photoshop. For example, I have a profile that uses the GRACoL ink colors, but has other parameters I’d like to change. The Custom CMYK interface is rather lacking.
  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. Click here to see how it is done.
  6. A solid method of adding local contrast. ‘HDR toning’ does this a bit, and a lot of other things at the same time too, making it less useful. ‘Clarity’ is pretty good, but tends to produce halos also. There are better methods.
  7. A ‘Vibrance’ tool for CMYK. This increases saturation without causing any channel to blow or plug.
  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.
  9. More color spaces. XYZ and xyY would be useful.
  10. Using Munsell colors in the color picker would be great, as well as better out-of-gamut warnings.
  11. Better statistical color tools. Something that can show all the colors in an image as a three-dimensional solid would be great.
Yeah, I know. All of this development is expensive, and it is easy to criticize!

Monday, November 28, 2011

Using ICC Profiles for Creative Color Control

Notice: the ICC profiles I link to in this article are now accessible again.



COLOR MANAGEMENT has become far easier since the introduction of standard ICC profiles, developed by the International Color Consortium, a group of various computer, digital camera, and imaging companies. ICC profiles describe the color handing characteristics of cameras, scanners, printers, and computer monitors, as well as allowing for uniform methods of converting the colors from one device to another. For example, ICC profiles are used to convert the colors captured by a camera to those colors available on a printer.

ICC profiles define a mapping from the typically limited color spaces of devices into a universal color space (which can describe all colors), such as CIELAB or CIEXYZ; from these universal spaces, the colors can then be mapped to an output device. As such, ICC profiles recognize limits of what is possible with any given device, and allows us to compare the capabilities of one device with another. If an output device, like a computer display or digital printer, cannot show particular colors, then the software will use the ICC profile to change the colors to the closest ones available (this will often cause the image to lose detail or saturation).

ICC profiles are also stored in image files, thereby interpreting the colors of the file, and these profiles are used during image editing. Typically, JPEG image files delivered by cameras are encoded into standard color spaces which are independent of the particular make and model of camera. The most common color spaces are sRGB and AdobeRGB; these provide a wide enough gamut of color for practical use, while being compact enough to produce reasonably small file sizes. ICC calls these "three component color encoding" standards. Using these standards are convenient because we can use JPEG or TIFF images from a wide variety of cameras without worrying about the specific characteristics of each. For example, an sRGB color value of (255, 0, 0) will describe the same bright red color, no matter where the image came from.  Some software, including web browsers, actually assume that all image files are encoded in the sRGB standard.

Click here for an overview of RGB color spaces.


I did not create this image. Click here for source and attribution. This shows the relative color gamuts of various RGB color profiles, as well as the color gamut of the Epson 2200 printer.

Each of the standard RGB ICC profiles defines three primary colors: particular shades of red, green, and blue. A narrow standard such as sRGB can describe about 35% of all colors, and so will have primary colors that aren't quite as bright, colorful, or saturated as the Wide Gamut RGB standard, which can describe about 77.6% of all colors. The ProPhoto standard is even bigger and has mathematical primaries that aren't even real colors.  However, be aware that most computer monitors and digital printers cannot display or print color much beyond the sRGB standard, and so sRGB is generally recommended for most uses on the Internet and for consumer-grade printing.

So ICC profiles have these uses:
  • Describing the color capability of a device.
  • A standard method of converting the colors from one device to another.
  • Describing the colors in an image file such as a digital photograph.
  • A widely accepted color standard for cross-platform image interchange.
May I also propose another use of ICC profiles?
  • Creative use. Artists can use ICC profiles to precisely manipulate and control the gamut of color in images.
In his book Professional Photoshop (5th Edition), Dan Margulis described the use of 'false profiles': using ICC profiles as an alternative method of image manipulation. He used this method to greatly brighten shadow detail without modifying the color: this is difficult to do with the standard Photoshop tools.

"photographs very rarely turn out good likenesses"

The first thing that caught my attention was a portrait of mother that hung over the writing table; a photograph in a magnificent carved frame of rare wood, obviously taken abroad and judging from its size a very expensive one. I had never heard of this portrait and knew nothing of it before, and what struck me most of all was the likeness which was remarkable in a photograph, the spiritual truth of it, so to say ; in fact it looked more like a real portrait by the hand of an artist than a mere mechanical print. When I went in I could not help stopping before it at once.

"Isn't it, isn't it?" Versilov repeated behind me, meaning, "Isn't it like?" I glanced at him and was struck by the expression of his face. He was rather pale, but there was a glowing and intense look in his eyes which seemed shining with happiness and strength. I had never seen such an expression on his face.

"I did not know that you loved mother so much !" I blurted out, suddenly delighted.

He smiled blissfully, though in his smile there was a suggestion of something like a martyr's anguish, or rather something humane and lofty ... I don't know how to express it; but highly developed people, I fancy, can never have triumphantly and complacently happy faces. He did not answer, but taking the portrait from the rings with both hands brought it close to him, kissed it, and gently hung it back on the wall.

"Observe," he said; "photographs very rarely turn out good likenesses, and that one can easily understand: the originals, that is all of us, are very rarely like ourselves. Only on rare occasions does a man's face express his leading quality, his most characteristic thought. The artist studies the face and divines its characteristic meaning, though at the actual moment when he's painting, it may not be in the face at all. Photography takes a man as he is, and it is extremely possible that at moments Napoleon would have turned out stupid, and Bismarck tender. Here, in this portrait, by good luck the sun caught Sonia in her characteristic moment of modest gentle love and rather wild shrinking chastity….
—from A Raw Youth, by Fyodor Dostoevsky (1821-1881), translated by Constance Garnett

Monday, November 14, 2011

Additive versus Subtractive Color

Visually-uniform color wheelTHE COLOR WHEEL is a basic tool for representing the relationship between colors. It is basic in that it only attempts to show the relationship between particular hues, and it is a tool only insofar as it is useful and not misleading. But we must recognize its limitations.

This wheel is only valid for the sRGB color space, since it explicitly uses the primary colors of that space; it may or may not be useful for other color spaces. Also, be aware that since this color space uses only three primary colors, it won’t be able to portray the entire color gamut of human vision. The wheel illustrates the principles of additive color, where we mix together various colors of light to get other colors; additive color works well enough with back-lit computer monitors and televisions, and also digital projectors. But this wheel is definitely not valid for mixing paints, watercolors, or other materials with color. It only works with light.

Additive mixing is conceptually simple

Mixing colors with light is an unusually pure and simple process that follows relatively basic mathematical laws. A computer scientist or programmer, or a digital photographer, not experienced with the manifold nuances of paints and pigments, can get a good representation of the world’s color with relatively little effort. But not so with the artist who works in oil paint: color mixing is a far more complex phenomenon.

Digital photography uses additive color — each phosphor on the computer monitor adds together with its companion phosphors to create a particular color. Adding together colored lights gives us brighter resulting colors. This addition is implicit in the color wheel above: with red, green, and blue as our primaries, mixing them together gives us our bright secondary colors of cyan, magenta, and yellow. If, for whatever reason, you had a computer monitor with primary colors made up of the cyan, magenta, and yellow phosphors of the wheel, you’d get a secondary colors which would be brighter and also less saturated: the secondary color made by mixing yellow and magenta would be a bright pink, and not red. But if we were to change the set of phosphors used in a monitor, we still should be able to accurately (and fairly easily) predict how our colors would mix.

Subtractive mixing

Paint is far more complicated. Light falls on paint, and some of it is absorbed (usually turning it into heat) while some of it is reflected, which leads to the color that we see. Leaves are green because their chlorophyl reflects green light — and they absorb much red and more blue light. So real-world objects subtract out some of the light falling on them, reflecting back colored light. Computer monitors have three, fixed colors which mix together, while real-world pigments reflect or absorb colors throughout the spectrum: this makes the subtractive colors of the painter much more complex.

For this reason, exceptionally pure and saturated paints are necessarily going to be rather dark: if a paint reflects only the far end of the color spectrum, near violet, then by necessity it will reflect only a tiny fraction of the total light falling on it. Fluorescence helps here, because normally invisible ultraviolet light is shifted in frequency to visible light — but this only works if the radiation falling on our paint has ultraviolet in it.

The colors should look the same...

Digital cameras have precisely three different kinds of color sensors, and the typical human eye also has three kinds of color receptors (plus another more noticeably used in low light). A camera and the eye collapses a broad range of hundreds of distinguishable light frequencies to merely three stimuli or numbers. But consider what this implies: various colored objects may absorb and reflect all sorts of differing frequencies of light, but they all may appear to be the same color to the human eye under a given lighting condition. To complicate matters, digital cameras and human eyes don’t have matching color sensitivity: they are fairly close within the range used in photography, and under good lighting conditions such as daylight or bright incandescent, but they don’t match for all colors or under all lighting conditions. They most certainly won’t match under poor quality light, such as found with plasma discharge lamps (including fluorescent lamps) and LED lighting.

Therefore you cannot say that mixing a yellow paint and blue paint — even if they appear to perfectly match the colors on our color wheel — will give you a gray mixture. You need to know which yellow, and which blue paint are used. After all, a wide variety of reflectances will give you same yellow or blue color. You cannot use a color wheel like the one above to predict the outcome of mixing paint.

A good theory of subtractive color mixing?

If we could measure the reflectance of each pigment, and measure the spectrum of light falling on the pigments, then we could predict, with much bother and mathematics, what the resulting color mixture would look like, although still we would have to take into account whether the paint is wet or dry, or what kind of brushes and brushstrokes were used, plus the opacity of the paint, plus the thickness of the paint, plus the texture and color of the canvas or board or paper on which the paint is applied.

With additive color we can reliably produce white, black, and shades of gray by mixing together all three of our primary RGB colors in equal quantities. White, of course, can’t be mixed by any combination of colored paints, nor can we reliably get pure black by mixing together a few colors. The color of the canvas or backing, as well as the opacity of the paint, will limit the brightest and darkest colors that can be produced. As it so happens, the white and black paints used by artists does not evenly reflect or absorb light uniformly, making the process of creating tints or shades not completely straightforward — mixing a color with black may cause the color to shift towards warmer or cooler tones if not done carefully.

The solution, the difficult, laborious solution to subtractive color mixing is experience, or otherwise having access to sample swatches — a very large number, thousands, of color mixes — although experience is definitely needed if you want to do good work.

Minimal palettes of colors

A good, comprehensive, predictive theory of subtractive color mixing is complicated to the extreme, far more complicated than the already complicated theory of additive color mixing. To reduce complexity, in photography, we limit ourselves to three primary colors, knowing that not all the colors visible to the human eye can be represented in their full glory, and knowing that we accept these limitations in order to practice our art. In the realm of painting, artists (especially beginning artists, or those painting in oil in plein air) often limit themselves to six or so colors, plus one or two kinds of black paint, and one or two kinds of white paint.

The idea of three primary colors works well with additive color, but even though it is limited, it is still used almost universally in digital photography: plus we have the advantage of being able to use mathematical primaries that are out of the range of human vision, expanding the gamut of colors we are able to accurately represent. But the use of three primary colors in painting is disastrous; following this misguided theory could cause an artist to severely limit his palette unnecessarily — although, if that is his artistic intent, that’s fine, it just isn’t a good theory of color. And so, a painter must select a set of paints, and typically this set is more than three colors. If the color of any given paint cannot be mixed with the other paints in the set, then that is a primary color. An artist may use additional colors, such as burnt sienna, which are located within the chosen gamut, but using these is largely a convenience and not necessity.

Three numbers suffice to describe any given color of light or pigment under controlled conditions. But three colors are never sufficient to make up a complete system of colors.

Sadly, most commercial and much digital printing technology uses only three primary colors — cyan, magenta, and yellow — plus black, which gives us a limited gamut of possible color, and which is highly dependent on the whiteness of the printing paper used. While adequate, painters can do far better by adding other colors which cannot be mixed by these primaries. Typically speaking, a gamut made of six bright, saturated colors is adequate for creating a minimal palette, with the colors being fairly visually equidistant to each other, along with black and white. An older split-palette theory of color mixing used three pairs of primary colors, with one of each pair mixing cool and the other which mixed warm. Oddly enough, even though the split palette is somewhat deprecated in painting, a form of this is used in high-end digital printers: pastel primary colors are used to get better color in highlights, and only a few digital printers use good red, greens and blue inks which are otherwise not mixable.

While painters may envy the purity and simplicity of color mixing available to photographers, they must not assume that the overly simplistic tools of the photographer — like the digital color wheel — apply to their art. Likewise, photographers may have a certain smugness over their control of color, but instead they ought to be humbled by the skill required by the artist when mixing colors, as well as the range of the artist’s palette, which far exceeds that found in digital printers.

Friday, October 14, 2011

Color Spaces, Part 3: HSB and HSL

IGNORE THIS ARTICLE: the information presented here is problematic, difficult to apply in Photoshop, is error prone, and obsolete. Do not read any farther. This information is of no importance to photographers.


OK, not really. This article is about color systems that ought to be useful, that ought to be implemented — somehow — in Photoshop, but they still have plenty of traps for the unwary.

Artists, unlike those who have an affinity for mathematics, may find the RGB color system a pain. They perhaps object to the idea of reducing such a subjective concept as color to mere numbers, or perhaps they object to the unintuitive process of mixing the colors together in RGB. Photoshop is such a pain. It must have been invented by nerds.

For example, the RGB color for a particular tone of orange is R=180, G=95, B=6. But this is ridiculous; orange, a mixture of red and green? And with some blue thrown in also? No, that's wrong. Orange is a mixture of red and yellow, and there ain't no blue it it at all: but for sure that dim tone of orange has some black in it. And what's with these RGB values going from 0 to 255??? That number 255 makes no sense at all. Now, if we have to use numbers (and why can't we use good names for colors instead?), then why not use something more understandable like 0% to 100%?

Also, it seems that some particularly pure colors are missing from RGB. Tyrian purple, intense electric cyan colors, and rich, deep tones are nowhere to be found.

A painter would rather describe color in ways other than RGB.  Here are some artists' color terms:

Hue is the basic quality of a color: is the color basically red, orange, yellow, chartreuse, green, aqua, blue, violet, or magenta? These hues are arranged in a circle around a color wheel, which shows how these colors relate to each other, and also how new colors can be obtained by mixing other colors. Now there is some controversy as to what precise set of colors ought to be used to obtain a minimal palette: some say that the three primary colors (red, yellow, and blue) is the minimum number of colors for a basic full-color palette; although white, black, or both are sometimes added to the mix, depending on whether the artist is using paint or watercolor. Other artists say that six colors (plus black and/or white) reproduces nearly the full range of color. Since these colors can mix together to produce nearly all known colors, any extra colors in the palette are simply a convenience to the artist; they aren't strictly needed. But no matter what color system is used, mixing together adjacent colors on the color wheel will produce novel colors, while mixing opposite colors together will give a grayish, blackish, or muddy tone.

Tints are pastel colors, made by mixing a color with white.

Shades are dark colors, made by mixing a color with black.

Brightness, value, or intensity tells us how close a color is in luminous quality to either white or black, or how bright a color is compared to the brightest available version of that color. Aqua is a brighter version of teal. Azure, dark midnight blue, and Dodger blue are basically only different in brightness.

Tones are colors that are mixed with both black and white (or gray) paint. These colors are muted, toned-down versions of the base colors.

Saturation, chroma, or colorfulness is how pure a particular color is. Tones, shades, and tints are less saturated than pure hues. Slate gray is less saturated than azure. Carmine is more saturated than copper rose, even though they are approximately the same hue and brightness.

Other qualities include transparency, fluorescence, glossiness, and so forth,


Tuesday, October 11, 2011

Deblurring



This is a technology preview of Photoshop software that can remove motion blur from an image.

Friday, October 7, 2011

A Visually-Uniform Digital Color Wheel

A WHILE BACK I published a color wheel, made according to the digital sRGB color standard. This standard color space is used with most digital cameras, and is the standard used by the Web and high-definition television. You can see this wheel by clicking here. But this wheel is wrong: rather, I present a new color wheel which is more visually uniform:

Visually-uniform color wheel

Most artist's color wheels, as found in art stores and Internet searches are quite misleading. The idea of a color wheel is to show the relationship between the colors. Of great importance is the idea of color opponency: if you mix two colors opposite from each other on the wheel, you will not get a third color, but rather gray. But these color wheels do not work for digital technology. Red, yellow, and blue — the primary colors typically used in these wheels — are not the primary colors used in digital photography.

But like the artist's color wheels, my old color wheel is also misleading:

bad


The primary and secondary color relationships shown here are correct. The primary colors of red, green, and blue are opposed to the secondary colors of cyan, magenta, and yellow, and if you mix these opposed colors in Photoshop you will indeed get a neutral gray. But the tertiary colors look wrong. Orange appears to be closer in brightness to red, being much darker than yellow, and likewise sky blue looks darker than it ought to be. There is hardly any differentiation between the green colors.

We are looking for the brightest colors we can as our primaries.  Setting R=255, with G and B both equal to 0, we will get the brightest and most saturated pure red that can be represented by the sRGB color system. The opponent color to red is cyan, which we get by setting R=0 and G and B both equal to 255, and this is the brightest and most saturated cyan we can represent in our system. When we mix these colors together, we get a neutral gray color. By default, Photoshop will average all these colors together to gray. As it so happens, the average color number ought to be 127.5, but since fractions are not possible when using Photoshop in 8-bit mode, we get either 127 or 128; but this is close enough.

Click here for an overview of the RGB color system.

The tertiary colors are halfway between adjacent primary and secondary colors. So the tertiary color between red and yellow will be orange. Our red value is equal to (255, 0, 0), while our yellow value is (255, 255, 0). Averaging these numbers together, I get a middle orange tone of (255, 127.5, 0). Rounding the green value up to 128 (since we can't use fractions), I get the orange tone shown in the old color wheel above. But it is too dark, too close to red in tonality than to yellow. The color appears to be correct, but not its brightness. So I set about manually trying to come up with a color that appeared to my eye to be halfway between red and yellow. Using a number of ad hoc methods to blend colors in Photoshop, I attempted to produce a visually continuous range of tones between each primary and secondary color. As it so happens, I found that the new tertiary colors were always brighter than my original estimates, in fact, the middle RGB value for these tertiaries were quite close to each other: I estimated that they all were around 180-190. Now this meant that the tertiary values across from each other on my color wheel were no longer opponents. Mixing my new orange with my new sky blue got me a somewhat dim and unsaturated green color. But I was willing to accept this shortcoming in order to portray my tertiary colors with visual uniformity.

My mistake was assuming that the mathematically intermediate value of 128 was also visually intermediate. This is wrong; I did not account for gamma correction. The human eye sees light in such a way that doubling the intensity of light only makes a scene to appear a bit brighter. Likewise, cutting the intensity of light by half makes the scene appear to be only a bit darker. Our eyes can operate under an extreme range in lighting due to this property. The practice of gamma correction adjusts the color tones in the RGB system so that the range of brightness is more visually uniform: otherwise, most of our RGB numbers would represent only the very brightest of colors and would neglect darker shades; our coding would be inefficient.

Now gamma correction requires more than simple arithmetic, and the sRGB standard uses a non-standard, non-uniform gamma correction to the RGB data, making this whole process murky. I'll spare you the details; instead, read the article linked above. What is important is that gamma correction does not change the values of 0 and 255 in 8-bit RGB color, it only modifies intermediate values, and so our calculations with our primary and secondary colors are unchanged. Only the tertiary colors will change with gamma correction. Intermediate values, after backing out the gamma correction of sRGB, become 187.5, and so in the color wheel above, I set the values to either 188 or 187.

This still leaves us the problem of mixing colors in Photoshop. Blending together opposite tertiary colors does not give us a neutral gray.  However, this has already been thought of. If you go to Edit-Color Settings, and then click More Options, we get this:

Color Settings

Select Blend RGB Colors Using Gamma 1.00, and the color mixing will be correct. This option subtracts out the gamma correction, allowing more accurate color blending. If we blend together our leaf green and our purple, under a gamma of 1, we will get a neutral gray color, and it will be the same shade of gray that we get if we blend together any of the opposing colors on the wheel. Since I'm not all that sure what other effects this option may have, it probably shouldn't be set at all times. But we do see that it in fact does produce more visually accurate color blends.

How does the wheel look? One problem is that the sRGB color gamut exceeds the capability of my calibrated iMac monitor, and so most of the colors here cannot be presented to my eye in their full glory. I find that I can hardly distinguish rose from magenta — how about you?