RGB color models are interesting. Color models. RGB

This is one of the most common and frequently used models. It is used in devices that emit light, such as monitors, spotlights, filters and other similar devices.

In the RGB model, derived colors are obtained by adding or mixing base, primary colors, called color coordinates. The coordinates are red (Red), green (Green) and blue (Blue). The RGB model got its name from the first letters of the English names of color coordinates.

Each of the above components can range from 0 to 255, forming different colors and thus providing access to all 16 million (the total number of colors represented by this model is 256 * 256 * 256 = 16,777,216.).

This model additive. The word additive (addition) emphasizes that color is obtained by adding points of three basic colors, each with its own brightness. The brightness of each base color can take values ​​from 0 to 255 (256 values), so the model can encode 256 3 or about 16.7 million colors. These triplets of base points (luminous points) are located very close to each other, so that each triple merges for us into a large point of a certain color. The brighter the color dot (red, green, blue), the more of that color will be added to the resulting (triple) dot.

When working with the Adobe PhotoShop graphic editor, we can choose a color, relying not only on what we see, but, if necessary, specify a digital value, thereby sometimes, especially when color correction, controlling the work process.

This color model is considered additive, that is, when Increasing the brightness of individual components will increase the brightness of the resulting color: If you mix all three colors with maximum intensity, the result will be white; on the contrary, in the absence of all colors the result is black.

Table 1

The meanings of some colors in the RGB model

The model is hardware-dependent, since the values ​​of the basic colors (as well as the white point) are determined by the quality of the phosphor used in the monitor. As a result, the same image looks different on different monitors.

The properties of the RGB model are well described by the so-called color cube (see Fig. 3). This is a fragment of three-dimensional space, the coordinates of which are red, green and blue. Each point inside the cube corresponds to a certain color and is described by three projections - color coordinates: the content of red, green and blue. Adding all the primary colors of maximum brightness gives the color white; the starting point of the cube means zero contributions of the primary colors and corresponds to the color black.

If color coordinates are mixed in equal proportions, the result is a gray color of varying saturation. The points corresponding to the gray color lie on the diagonal of the cube. Mixing red and green produces yellow, red and blue produce magenta, and green and blue produce cyan.

Rice. 3.

Color coordinates: red, green, and blue are sometimes called primary or additive colors. The colors cyan, magenta, and yellow, which are obtained as a result of pairwise mixing of primary colors, are called secondary. Since addition is the basic operation of color synthesis, the RGB model is sometimes called additive (from the Latin additivus, which means added).

The principle of adding colors is often depicted in the form of a flat circular diagram (see Fig. 4), which, although it does not provide new information about the model, compared to a spatial image, is easier to perceive and easier to remember.

Rice. 4.

Many technical devices work on the principle of color addition: monitors, televisions, scanners, overhead projectors, digital cameras, etc. If you look through a magnifying glass at the monitor screen, you can see a regular grid, at the nodes of which there are red, green and blue phosphor grain dots . When excited by a beam of electrons, they emit basic colors of varying intensities. The addition of radiation from closely spaced grains is perceived by the human eye as color at a given point on the screen.

In computer technology, the intensity of primary colors is usually measured by integers in the range from 0 to 255. Zero means the absence of a given color component, the number 255 means its maximum intensity. Since primary colors can be mixed without restriction, it is easy to calculate the total number of colors that an additive model produces. It is equal to 256 * 256 * 256 = 16,777,216, or more than 16.7 million colors. This number seems huge, but in reality the model produces only a small part of the color spectrum.

Any natural color can be broken down into its red, green and blue components and their intensity measured. But the reverse transition is not always possible. It has been experimentally and theoretically proven that the range of colors in the RGB model is narrower than many colors in the visible spectrum. To obtain the part of the spectrum lying between blue and green, emitters with a negative red intensity are required, which, of course, do not exist in nature. The range of colors a model or device can reproduce is called color gamut. One of the serious disadvantages of the additive model, as paradoxical as it may sound, is its narrow color gamut.

It seems that this set of color coordinates uniquely defines a light green color on any device that works on the principle of adding base colors. In reality, things are much more complicated. The color reproduced by the device depends on many external factors, which often cannot be taken into account.

Display screens are coated with phosphors that differ in chemical and spectral composition. Monitors of the same brand have different wear and lighting conditions. Even one monitor produces different colors when warmed up and immediately after turning on. By calibrating devices and using color management systems, you can try to approximate the color gamuts of different devices. This is discussed in more detail in the next chapter.

It is impossible not to mention one more drawback of this color model. From the point of view of a practicing designer or computer artist, it is non-intuitive. Operating in its environment, it can be difficult to answer the simplest questions related to color synthesis. For example, how should the color coordinates be changed to make the current color a little brighter or less saturated? To answer this simple question correctly requires a lot of experience with this color system.

A color TV or your computer monitor is based on the principle of this division of light. To put it very roughly, the monitor you are looking at now consists of a huge number of dots (their number vertically and horizontally determines the resolution of the monitor) and three “lights” shine at each of these dots: red, green and blue. Each “light bulb” may shine with different brightness, or may not shine at all. If only the blue “light” shines, we see a blue dot. If only red, we see a red dot. Same with green. If all the light bulbs shine with full brightness at one point, then this point turns out to be white, since all the gradations of this white again come together. If no light bulb is shining, then the point appears black to us. Because black is the absence of light. By combining the colors of these “light bulbs”, glowing with different brightness, you can get different colors and shades.

The brightness of each such light bulb is determined by the intensity (division) from 0 (the “light bulb” is turned off) to 255 (the “light bulb” shining with full “power”). This division of colors is called the RGB color model from the first letters of the words “RED” “GREEN” “BLUE” (red, green, blue).


Thus White color our point in the RGB color model can be written in the following form:

R (from the word "red", red) - 255

G (from the word "green", green) - 255

B (from the word "blue", blue) - 255


A "rich" red would look like this:



The yellow color will look like this:


Also, to record colors in rgb, the hexadecimal system is used. The intensities are shown in #RGB order:

White - #ffffff

Red - #ff0000

Black - #00000

Yellow - #ffff00

CMYK color model

So, now we know in what cunning way our computer conveys to us the color of a particular point. Let's now use our acquired knowledge and try to get white using paints. To do this, we’ll buy gouache at the store, take jars of red, blue and green paint, and mix them. Happened? Neither do I.

The problem is that our monitor emits light, that is, it glows, but in nature many objects do not have this property. They simply reflect the white light that falls on them. Moreover, if an object reflects the entire spectrum of white light, then we see it as white, but if part of this light is absorbed by it, then not completely.

Something like this: we shine white light on a red object. White light can be thought of as R-255 G-255 B-255. But the object does not want to reflect all the light that we directed at it, and brazenly steals all the shades of green and blue from us. As a result, only R-255 G-0 B-0 is reflected. That is why it appears red to us.

So for printing on paper it is very problematic to use the RGB color model. For this, as a rule, the CMY (tsmi) or CMYK (tsmik) color model is used. The CMY color model is based on the fact that the sheet of paper itself is white, that is, it reflects almost the entire RGB spectrum, and the colors applied to it act as filters, each of which “steals” its own color (either red or green, or blue). Thus, the colors of these paints are determined by subtracting RGB colors from white one at a time. The resulting colors are Cyan (something like blue), Magenta (one might say pink), Yellow (yellow).

And if in the RGB color model the gradation of each color occurred according to brightness from 0 to 255, then in the CMYK color model the main value for each color is “opacity” (the amount of paint) and is determined by percentages from 0% to 100%.


Thus, white color can be described as follows:

C (cyan) - 0%; M (magenta) - 0%; Y (yellow) - 0%.

Red - C-0%; M-100%; Y-100%.

Green - C-100%; M-0%; Y-100%.

Blue - C-100%; M-100%; Y-0%.

Black - C-100%; M-100%; Y-100%.

However, this is only possible in theory. But in practice, it’s impossible to get by with CMY colors. And the black color when printed turns out to be more of a dirty brown, the gray does not look like itself, and it is problematic to create dark shades of colors. Another paint is used to adjust the final color. Hence the last letter in the name CMYK (TsMIK). The decoding of this letter can be different:

It may be short for blacK (black). And in the abbreviation it is the last letter that is used so as not to confuse this color with the Blue color in the RGB model;

Printers very often use the word "Outline" in relation to this color. So it is possible that the letter K in the abbreviation CMYK is an abbreviation for the German word "Kontur";

It can also be an abbreviation for Key-color (key color).

However, it is difficult to call it key, since it is rather additional. And this color doesn’t quite look like black. If you print only with this ink, the image turns out to be rather gray. Therefore, some are of the opinion that the letter K in the CMYK abbreviation stands for “Kobalt” (dark gray, German).

Typically, the term "black" or "black" is used to refer to this color.

Printing using CMYK colors is called "full color" or "process".

*It’s probably worth saying that when printing CMYK (CMIK) paints do not mix. They lie on the paper in “spots” (raster patterns) one next to the other and mix in the person’s imagination, because these “spots” are very small. That is, the image is rasterized, since otherwise the paint, falling on one another, will blur and moiré or dirt will form. There are several different rasterization methods.


Grayscale color model

Many people mistakenly call an image in the grayscale color model black and white. But that's not true. A black and white image consists of only black and white tones. While grayscale (grayscale) has 101 shades. This is a Kobalt color gradation from 0% to 100%.

Device-dependent and device-independent color models

The CMYK and RGB color models are device-dependent, meaning they depend on the way color is transmitted to us. They tell a specific device how to use their corresponding dyes, but have no knowledge of how the final color is perceived by humans. Depending on the brightness, contrast and sharpness settings of the computer monitor, the room illumination, and the angle at which we look at the monitor, color with the same RGB parameters is perceived differently by us. And a person’s perception of color in the “CMYK” color model depends on an even larger number of conditions, such as the properties of the printed material (for example, glossy paper absorbs less paint than matte paper, so the colors on it are brighter and more saturated), characteristics of the paint, air humidity , at which the paper dried, the characteristics of the printing press...

To convey more reliable information about color to a person, so-called color profiles are attached to device-dependent color models. Each of these profiles contains information about a specific method of transmitting color to a person and regulates the final color by adding or subtracting parameters from any component of the original color. For example, when printing on glossy film, a color profile is used that removes 10% Cyan and adds 5% Yellow to the original color, due to the characteristics of the particular printing machine, the film itself and other conditions. However, even attached profiles do not solve all the problems of transmitting color to us.

Device-independent color models do not carry information to convey color to humans. They mathematically describe the color perceived by a person with normal color vision.

HSB and HLS color models

This color space is based on the familiar RGB rainbow ring. Color is controlled by changing parameters such as:

Hue- shade or tone;

Saturation- color saturation;

Brightness- brightness.


The hue parameter is the color. Determined in degrees from 0 to 360 based on the colors of the rainbow ring.

The saturation parameter - the percentage of white paint added to this color has a value from 0% to 100%.

The Brightness parameter - the percentage of adding black paint also varies from 0% to 100%.

The principle is similar to one of the representations of light from a fine art perspective. When white or black paint is added to existing colors.

This is the easiest color model to understand, which is why many web designers love it. However, it has a number of disadvantages:

The human eye perceives the colors of the rainbow ring as colors that have different brightnesses. For example, spectral green has greater brightness than spectral blue. In the HSB color model, all colors in this circle are considered to have a brightness of 100%, which, unfortunately, is not true.

Since it is based on the RGB color model, it is still hardware-dependent.

This color model is converted to CMYK for printing and converted to RGB for display on a monitor. So guessing what color you will end up with can be quite problematic.


The HLS color model is similar to this model (interpretation: hue, lightness, saturation).

Sometimes used to correct light and color in an image.


LAB color model

In this color model, a color consists of:

Luminance - illumination. This is a combination of the concepts of brightness (lightness) and intensity (chrome)

A- a color range from green to purple

B- color range from blue to yellow


That is, two indicators together determine the color and one indicator determines its illumination.

LAB - This is a device-independent color model, that is, it does not depend on the way color is transmitted to us. It contains both RGB and CMYK colors, and grayscale, which allows it to convert an image from one color model to another with minimal loss.

Another advantage is that, unlike the HSB color model, it corresponds to the peculiarities of color perception by the human eye.

Often used to improve image quality and convert images from one color space to another.



RGB is an abbreviation of the English words Red, Green, Blue. This model is intended to describe the emitted colors. The basic components of the model are based on three rays - red, blue and green, because... human perception of color is based precisely on them. The rest of the palette is created by mixing three primary colors in various proportions. It should be noted that by applying two primary colors, the resulting color will be lighter than the base components. On the other hand, white is a shade of gray that is created by mixing three base colors equally, but with different saturations. The colors of this model are called additive.

RGB color model

Images on the monitor screen, as well as those obtained by scanning, are encoded in the RGB model.

The color space of a model is sometimes represented as a color cube.

Representation of the RGB model in graphical form

The axes display the values ​​of color channels, each of which can take values ​​from zero (no light) to 255 (highest light brightness). The cube contains all the colors of the model. At the origin point of the coordinate axes, all channel values ​​are equal to zero (black), and at the opposite point, the maximum channel values ​​when mixed form a white color. If these two points are connected by a segment, then on this segment there will be a scale of shades from black to white - a gray scale. The three vertices of the cube produce three pure original colors. In turn, each of the other three vertices between them gives a pure color mixed from the two main ones. Each color channel and gray scale has 256 shades of gray.

The CMY model is for describing reflected colors. The colors of this model are based on subtracting part of the spectrum of incident light (white) and are called subtractive. When two primary colors are mixed, the result will be darker than any of the original colors, since each color absorbs a different part of the spectrum. CMY channels are the remainder of subtracting the basic RGB components from white (as we know, white consists of a full spectrum of colors). In this case, the following colors remain: Cyan - blue (white minus red). Magenta - purple (white minus green), Yellow - yellow (white minus blue).

CMY color model

As an improvement to this model, the CMYK model appeared, which was created to describe the process of full-color printing, for example, on a color printer. Magenta, cyan and yellow inks are successively applied to the paper in varying proportions. The printer head is designed in such a way that it allows you to use these colors (printing triad) simultaneously and in one pass over the paper. The primary colors applied to one place are mixed to form the required shades. However, black color cannot be obtained by mixing three primary colors, because Instead of black, it will be more of a gray-brown color. To achieve pure blacks and shades of gray, a new component has been added to the CMY model - black. In the CMYK color model, this is the letter K (B1acK). Thus, CMYK is a four-channel color model.

The CMYK model is used to describe printed images. Its color gamut is significantly lower than that of RGB, since the CMYK model describes reflected colors, the intensity of which is always less than that of emissive ones. CMYK can be considered as a derivative of the CMY model. The space of this model is similar to the space of the RGB model, only with the origin moving.

Representation of the CMYK model in graphical form

Mixing all three components at maximum values ​​gives black color. On the other hand, with a complete absence of paint and, accordingly, zero values ​​of the main components, the color will be white. When applied to CMYK, white should be thought of as white paper. Mixing the basic components with equal values ​​produces shades of gray and creates a gray scale.

This color model has a few quirks that can make switching to it a bit of a hassle. The fact is that the CMYK color gamut is not large enough, and converting to this model from the RGB model can lead to some color distortions. Some colors from the gamut of the RGB model cannot be reproduced on paper, and as a result are not included in the gamut of the CMYK model. This model has problems rendering bright blues, blues, greens and oranges. When converted, these colors are converted to the closest CMYK color to them.

Although the image is not edited in CMYK, however, if it is being prepared for printing, there is often a need to view the correspondence of the image colors to the color gamut of the model. Whenever the need arises, converting an image to CMYK and back to RGB will most likely result in degraded image quality. Therefore, if there is such a possibility, you need to resort to additional tools, such as, for example, in Photoshop - the function of viewing an image in the CMYK model without actually converting it to this model.

Like the RGB model, the CMYK model is annapamo-dependent. This means that the same graphic image will look different when used with different output and printing devices (such as monitors and color printers). It should also be borne in mind that the resulting color depends not only on the values ​​of the basic components, but also on the parameters of the devices: the properties of the paper used, the characteristics of the printers, the properties of the phosphor in monitors from various manufacturers, the presence of hardware color control of the monitor, as well as the properties of the video card .

In the process of preparing and printing an image, devices working in both RGB and CMYK models are involved. The first include monitors, scanners and digital cameras, and the second include color printers and phototypesetting machines. Since the color gamuts of these devices differ, the necessary conversions from one model to another involve inevitable color and shade distortions. Therefore, to achieve predictable color, a special color correction system was created - a program whose goal is to achieve the same colors for all stages of working with images, from scanning to printing.

In the Russian tradition it is sometimes designated as KZS.

The choice of primary colors is determined by the physiology of color perception by the retina of the human eye. The RGB color model is widely used in technology.

It is called additive because colors are obtained by adding (eng. addition) to black. In other words, if the color of the screen illuminated by a color spotlight is indicated in RGB as (r 1, g 1, b 1), and the color of the same screen illuminated by another spotlight is (r 2, g 2, b 2), then when illuminated by two spotlights, the color of the screen will be designated as (r 1 + r 2 , g 1 +g 2, b 1 +b 2).

The image in this color model consists of three channels. When mixing primary colors (the primary colors are red, green and blue) - for example, blue (B) and red (R), we get purple (M magenta), when mixing green (G) and red (R) - yellow (Y yellow), when mixing green (G) and blue (B) - cyan (C cyan). When all three color components are mixed, we get white (W).

Definition

The RGB color model was originally developed to describe color on a color monitor, but since monitors vary from model to model and manufacturer, several alternative color spaces have been proposed to correspond to the "average" monitor. These include, for example, sRGB and Adobe RGB.

Variants of this color space differ in different shades of primary colors, different color temperatures, and different gamma correction values.

Representation of RGB basic colors according to ITU recommendations, in Kelvin space (daylight)

Red: x=0.64 y=0.33 Green: x=0.29 y=0.60 Blue: x=0.15 y=0.06

Matrices for converting colors between RGB and brightness systems when converting an image to black and white):

X = 0.431*R+0.342*G+0.178*B Y = 0.222*R+0.707*G+0.071*B Z = 0.020*R+0.130*G+0.939*B R = 3.063*X-1.393*Y-0.476*Z G = -0.969*X+1.876*Y+0.042*Z B = 0.068*X-0.229*Y+1.069*Z

Numeric representation

RGB color model represented as a cube

For most applications, the coordinate values ​​r, g, and b can be considered to belong to the segment , which represents RGB space as a 1x1x1 cube.

COLORREF

COLORREF- standard type for representing colors in Win32. Used to define colors in RGB form. Size - 4 bytes. When defining any RGB color, the value of a COLORREF type variable can be represented in hexadecimal as follows:

0x00bbggrr

rr, gg, bb - the intensity value of the red, green and blue components of the color, respectively. Their maximum value is 0xFF.

You can define a variable of type COLORREF as follows:

COLORREF C = (b,g,r);

b, g and r are the intensity (in the range from 0 to 255) of the blue, green and red components of the defined color C, respectively. That is, bright red color can be defined as (255,0,0), bright purple - (255 ,0,255), black - (0,0,0), and white - (255,255,255)

The additive primary color model is used to reproduce the visible light spectrum and represents anything that transmits, filters, or senses light waves, such as monitors, televisions, slides, and our eyes. Nowadays, this model is increasingly being called RGB. (From English Red - “red”, Green - “green”, Blue - “blue”.)

In this model, black is the absence of any light, and white is the maximum equal intensity of the three colors. To create different colors you need to add different levels of red, green and blue. If the intensity of the colors is equal, then different shades of gray will be obtained.

The subtractive complementary color model represents reflected light, that is, the colors we see in images - printed in ink, inkjet, or drawn. This model is now called CMY

(from English Cyan - “blue”, Magenta - “purple”, Yellow - “yellow”). The CMY model is the opposite of the RGB model. In this model, black is created with full values ​​of all colors (cyan, magenta, and yellow), and to create different shades, the levels of the primary colors must be reduced.

White color will be obtained in the complete absence of the indicated primary colors (if, of course, the paper is white). Since RGB and CMY complement each other, there is a certain relationship between them. If we consider these colors in the form of a color wheel, then the RGB and CMY colors will alternately change in it. If you mix two RGB colors, you get a CMY value; if, on the contrary, you mix two CMY colors, then this time you get an RGB value. For example, the RGB model describes yellow as a mixture of red and green. And in the CMY model, green is described as a mixture of cyan and yellow. Look at the RGB-CMY color wheel. When two colors from one pattern are mixed to create the color of another, there is still one color left in the first pattern. It's called optional. For example, magenta and yellow are used to create red, so the complementary color of red is cyan. On the color wheel, blue is directly opposite red.

When printing color photographs using the analogue method, filters colored in CMY colors are used to eliminate unwanted shades. For example, the print has a blue tint. Since the complementary color of blue is yellow, a yellow filter of a certain density is used when printing.

Do not confuse the CMY model with the CMYK printing color space. K stands for black dye, which is added to all other colors to give depth to the color. If you try to print black with a mixture of cyan, magenta and pink, you will end up with a dirty brown tint.