Colorspaces This chapter gives information on what colorspaces are, which colorspaces &chalk; offers, and what you should keep in mind when using them. Introduction to colorspaces What is a colorspace? In short, a colorspace is a way to represent colors by specifying a number of parameters. As parameters, one can choose for example the amounts of red, green and blue light needed for the color. This results in the commonly known RGB colorspace. One can visualize this as a three-dimensional space, with each of the red, green, and blue light components being an axis in the colorspace. A color then corresponds to a certain point in this colorspace, defined by its coordinates on the three axes. To be more precise, a colorspace is a combination of a color model (indicating which axes are present) and a mapping function (indicating which values correspond to which colors). Not every color can be represented in every colorspace. Some colorspaces define more, or different, colors than others. The set of colors that can be represented in a certain colorspace is called its gamut. Because gamuts can differ widely, it is not guaranteed that images in a certain colorspace can be converted to another colorspace without having to substitute certain colors for others, even if they are based on the same color model. Available colorspaces &chalk; offers colorspaces based on RGB, CMYK, Lab, LMS, YCbCr, and Gray color models. These are shortly discussed in this section. The RGB color models The abbreviation RGB stands for Red, Green, Blue, and the color model with this name refers to the three light components that are emitted in displays (televisions, computer monitors, etcetera) to create a certain color. This color model is used by default in virtually any standard painting application. When defining a color in the RGB model, its red, green and blue components are specified. If all components are absent (each component is emitted at 0 percent intensity, so no light at all), the color is pure black. If all components are fully present (100 percent intensity), the color is pure white. If one component is present at full intensity and the other two are absent, the pure respective color is obtained. Two more examples: if both red and green are emitted at 100 percent and blue is not emitted, pure yellow is obtained. A color with all three components at the same intensity is a shade of gray. There are various colorspaces that implement the RGB model. For example, the so-called RGB8 colorspace represents each color with 8 bits per component. Since 8 bits allow for 256 distinct values, the total number of different colors that can be specified in this colorspace is 256 (red) * 256 (green) * 256 (blue), or about 16.7 million colors. In &chalk;, a couple of RGB colorspaces are available, for example RGB32, which is able to distinguish between 4.2 billion values per component. The CMYK color model CMYK is the abbreviation for Cyan, Magenta, Yellow, blacK (although officially the K stands for Key, black is much more commonly used). This color model is based on ink: a color is specified by the amount of ink needed for a point to be perceived as having that color. Since CMYK colors are used by printers while RGB colors are used on-screen, one often wants to convert RGB colors to CMYK colors. As this cannot always be done correctly, printed images may turn out to look quite different than what is perceived on-screen. The L*a*b* color model This color model uses three parameters for a color: its luminance or lightness (L*, which lies between 0 for black and 100 for white), its position between absolute red and absolute green (a*, which is negative for colors closer to green and positive for colors closer to red), and its position between yellow and blue (b*, which is negative for colors closer to blue and positive for colors closer to yellow). The LMS color model This model is based on the contribution of actual light wave lengths to the color. The human eye is sensitive to three types of light waves, distinguished by their wave lengths: long (L), middle (M) and short (S) waves. The eye's sensitivity for a certain color on these three wavelengths can be expressed in L, M and S coordinates. The YCbCr color model The YCbCr model is often used for video systems. The Y parameter indicates the luminance or lightness of the color (which can be seen as a gray-tone), the Cb and Cr parameters indicate the chrominance (color tone): Cb places the color on a scale between blue and yellow, Cr indicates the place of the color between red and green. The Gray color model The Gray color model simply represents colors as shades of gray (with black and white being the extremes).