Hardware and software setup

Drawing in GIMP. Cool color combination cheat sheet Primary colors in computer graphics

Color in computer graphics.

When working with color, the following concepts are used: color depth (it is also called color resolution) and color model.
To encode the color of an image pixel, a different number of bits can be allocated. This determines how many colors on the screen can be displayed simultaneously. The longer the color binary code, the more colors can be used in the drawing. Color depth is the number of bits used to encode the color of one pixel. To encode a two-color (black and white) image, it is enough to allocate one bit per color representation of each pixel. The allocation of one byte allows you to encode 256 different color shades. Two bytes (16 bits) allow you to define 65536 different colors. This mode is called High Color. If three bytes (24 bits) are used for color encoding, 16.5 million colors can be displayed simultaneously. This mode is called True Color. The color depth determines the size of the file in which the image is saved.

Colors in nature are rarely simple. Most color shades are formed by mixing primary colors. The method of dividing a color shade into its constituent components is called color model. There are many various types color models, but in computer graphics, as a rule, no more than three are used. These models are known under the names: RGB, CMYK, HSB.

1. RGB color model.

The most easy to understand and obvious model is RGB. Monitors and household TVs work in this model. Any color is considered to consist of three main components: red (Red), green (Green) and blue (Blue). These colors are called primary.

It is also believed that when one component is superimposed on another, the brightness of the overall color increases. The combination of the three components gives a neutral color (gray), which tends to white at high brightness. This corresponds to what we observe on the monitor screen, so this model are used whenever an image is being prepared to be displayed on a screen. If the image undergoes computer processing in a graphics editor, then it should also be presented in this model.
The method of obtaining a new hue by summing the brightness of the constituent components is called additive method. It is used everywhere where a color image is viewed in transmitted light ("through"): in monitors, slide projectors, etc. It is easy to guess that the lower the brightness, the darker the shade. Therefore, in the additive model, the central point, which has zero values ​​of the components (0,0,0), is black (the absence of a glow on the monitor screen). The white color corresponds to the maximum values ​​of the components (255, 255, 255). The RGB model is additive, and its components: red (255.0.0), green (0.255.0) and blue (0.0.255) are called primary colors.

2. CMYK color model.

This model is used to prepare not screen, but printed images. They differ in that they are seen not in transmitted, but in reflected light. The more ink is placed on the paper, the more light it absorbs and the less it reflects. The combination of the three primary colors absorbs almost all the incident light, and from the side the image looks almost black. Unlike the RGB model, an increase in the amount of paint does not lead to an increase in visual brightness, but rather to its decrease.

Therefore, for the preparation of printed images, not an additive (summative) model is used, but subtractive (subtractive) model. The color components of this model are not primary colors, but those that result from subtracting primary colors from white:
blue= White - Red = Green + Blue (0.255.255)
purple (lilac) (Magenta)= White - Green = Red + Blue (255.0.255)
yellow= White - Blue = Red + Green (255.255.0)
These three colors are called additional because they complement the primary colors to white.
A significant difficulty in printing is the black color. Theoretically, it can be obtained by combining three basic or additional colors, but in practice the result is unusable. Therefore, a fourth component has been added to the CMYK color model - the black. This system is obliged to him by the letter K in the name (blackK).

In printing houses, color images are printed in several stages. By imposing cyan, magenta, yellow and black prints in turn on paper, a full-color illustration is obtained. Therefore, the finished image obtained on a computer is divided into four components of a single-color image before printing. This process is called color separation. Modern graphic editors have the means to perform this operation.
Unlike the RGB model, the center dot is white (no dyes on white paper). A fourth one has been added to the three color coordinates - the intensity of black paint. The black axis looks isolated, but it makes sense: adding color components to black will still result in black. Everyone can check the addition of colors in the CMYK model by picking up blue, chamois and yellow pencils or felt-tip pens. A mixture of blue and yellow on paper gives green, lilac and yellow - red, etc. When all three colors are mixed, an indeterminate dark color is obtained. Therefore, in this model, black was also needed additionally.

3. HSB color model.

Some graphics editors allow you to work with the HSB color model. If the RGB model is the most convenient for a computer, and the CMYK model is for printing houses, then the HSB model is the most convenient for a person. It is simple and intuitive. The HSB model also has three components: color hue (hue), color saturation (Saturation) And color brightness (Brightness). By adjusting these three components, you can get just as many arbitrary colors as with other models. The hue of a color indicates the number of a color in the spectral palette. The saturation of a color characterizes its intensity - the higher it is, the "cleaner" the color. The brightness of the color depends on the addition of black to the given one - the more it is, the less the brightness of the color. The HSB color model is convenient for use in those graphic editors, which are focused not on the processing of finished images, but on their creation with their own hands. There are programs that allow you to imitate various artist's tools (brushes, pens, felt-tip pens, pencils), paint materials (watercolor, gouache, oil, ink, charcoal, pastel) and canvas materials (canvas, cardboard, rice paper, etc.). Creating your own piece of art, it is convenient to work in the HSB model, and at the end of the work it can be converted to the RGB or CMYK model, depending on whether it will be used as a screen or printed illustration. The color value is chosen as a vector coming out of the center of the circle. The dot in the center corresponds to white (neutral) color, and the dots around the perimeter correspond to pure colors. The direction of the vector determines the hue and is specified in the HSB model in degrees of angle. The length of the vector determines the saturation of the color. The color intensity is set on a separate axis, the zero point of which is black.

3.1. Additive color model

3.2. Forming your own color shades in the RGB model

3. Color in computer graphics

Those who are engaged computer graphics, must clearly distinguish not only colors, but also the finest shades. This is very important, since it is the color that carries a large amount of information, which is no less important than the shape, mass and other parameters of each physical object.

Properly chosen colors can both draw attention to the image, and push away from it. Depending on what color a person sees, he has different emotions that form the first impression of the object. There is even a whole science that studies the effect of color on a person.
So, why do you need color in computer graphics?

  • Color carries certain information about objects. For example, trees are green in summer and yellow in autumn. It is almost impossible to determine the time of the year in a black and white photograph, unless some other additional facts indicate this.
  • Color is necessary in order to distinguish objects.
  • With it, you can bring some parts of the image to the fore, others - to the background, thus focusing attention on the most important - the compositional center.
  • Without increasing the size, color can convey some of the details of an image.
  • In two-dimensional graphics (which we see on a monitor, since it does not have a third dimension), it is with the help of color, or rather shades, that volume is imitated.
  • Finally, color is used to grab the viewer's attention, creating a colorful and interesting image.
  • Of course, you can create great black and white creations, but since we live in a world of color, it is much more common to see colored objects.

Color is a subjective characteristic of an object. Color exists only when there is an observer. Real light (for example, daylight) is electromagnetic radiation, a mixture of different light waves, that is, it has a different spectrum. The human eye captures light waves in a certain range of lengths and intensities (visible radiation spectrum). The brain then processes the incoming signals, perceiving objects differently colored depending on the combination of wavelengths and their intensity. Thus, in reality, color refers not only to the object itself, but also to the features of the physiological perception of a particular observer. Like taste, smell, hearing and other senses, the perception of color also varies from person to person. We can perceive a color as warm, cool, heavy, light, soft, strong, exciting, relaxing, shiny, or dull. However, in each case, perception depends on the person's culture, language, age, gender, living conditions and previous experience. Two people will never perceive the same physical color in the same way. People differ from each other even in their sensitivity to the range visible light. Perception is also affected by the size of the object.



The world around us is full of all sorts of colors and shades. With the development of many industries, including printing, computer technology, there is a need for objective methods for describing and processing color.

Colors in nature are rarely simple. Most colors are obtained by mixing some other colors. For example, a combination of red and blue gives magenta, blue and green - cyan. Thus, by mixing, from a large number simple colors, you can get a lot (and quite a lot) complex (composite). Therefore, to describe color, the concept is introduced color model- as a way of representing a large number of colors by decomposing it into simple components.

In each model, a certain range of colors is represented as 3D space. In this space, each color exists as a set of numerical coordinates. This method makes it possible to transfer color information between computers, programs and peripherals.

A natural question arises: why is all this necessary? Wouldn't it be easier to take and present in the color model not the main ones, but all possible colors? Of course not! It is very difficult to give a description of each color separately, especially now, when on the monitor screen we have the opportunity to see not hundreds, not thousands, but 4 billion colors (more precisely, colors and color shades)! Try to describe each color separately. Thus, color models are an almost perfect way to describe colors, especially in computer technology and printing. Why almost? The fact is that not every color can be represented as a combination of basic ones. This is the main problem with color models.

3.1. Additive color model

emitted color - is the light coming from a source such as the sun, a light bulb, or a monitor screen. The emitted color, going directly from the source to the eye, retains all the colors from which it is created. When reflected from an object, the light can change. Any object that is not a light source partially reflects and partially absorbs the light falling on it.

Like the sun and other light sources, a monitor emits light. The paper on which the image is printed reflects light. Since color can be obtained in the process of radiation and in the process of reflection, there are two opposite methods for describing it: additive and subtractive color models.

The emitted light is described using an additive color model.

If you look at the screen of a working monitor or TV from a close distance (and even better - with a magnifying glass), then it is easy to see many tiny dots of red, green and blue colors, the so-called primary, basic or primary colors. The fact is that each video pixel on a color screen is a collection of three dots of different colors: red, green and blue. Since they are very small, our eyes mix three colors into one. Thus, adjacent multi-colored dots merge, forming other colors. An example of this is a spinning disc, half of which is colored yellow and the other half blue. When the disk spins fast, we see green, but we don't see blue and yellow.

Red + green = yellow

red + blue = magenta

green + blue = cyan

red + green + blue = white

By changing the intensity of the glow of colored dots, you can create a wide variety of shades.

Thus, additive (from English add - attach) color is obtained by combining (summing) the three primary colors - red, green and blue. If the intensity of each of them reaches 100%, then white is obtained. The absence of all three colors results in black.

The additive color model used in computer monitors is usually denoted by the abbreviation RGB (rgb OR rzhb) (Red (ed) - red, Green (Green) - green, Blue (blue) - blue).

3.2. Forming your own color shades in the RGB model

The RGB model describes emitted colors. The basic components of the model are three colors of rays - red, green, blue. When color is perceived by a person, it is they that are perceived by the eye. The remaining colors are a mixture of the three base colors in different proportions. When adding (mixing) two rays of primary colors, the result is lighter than the components. Colors of this type are called additive. RGB is a three-channel color model. In the RGB model, the scanner encodes the image and displays the monitor screen.

a stream of electromagnetic waves of various lengths and amplitudes. The human eye being complex optical system, perceives these waves in the range of lengths from approximately 350 to 780 nm. Light is perceived either directly from a source, for example, from lighting fixtures, or as reflected from the surfaces of objects or refracted when passing through transparent and translucent objects. Color is a characteristic of the perception of electromagnetic waves of different lengths by the eye, since it is the wavelength that determines the visible color for the eye. The amplitude, which determines the energy of the wave (proportional to the square of the amplitude), is responsible for the brightness of the color. Thus, the very concept of color is a feature of the human "vision" of the environment.


Rice. 2.1.

On fig. 2.1 is a schematic representation of the human eye. Photoreceptors located on the surface of the retina act as light receivers. The lens is a kind of lens that forms an image, and the iris plays the role of a diaphragm, regulating the amount of light transmitted into the eye. The sensitive cells of the eye respond differently to waves of different wavelengths. Intensity light is a measure of the energy of light affecting the eye, and brightness is a measure of the perception of this effect by the eye. The integral curve of the spectral sensitivity of the eye is shown in fig. 2.2; this standard curve of the International Commission on Illumination (CIE, or CIE - Comission International de l "Eclairage).

There are two types of photoreceptors: rods and cones. The sticks are highly sensitive and work in low light conditions. They are insensitive to wavelength and therefore do not "distinguish" colors. Cones, on the contrary, have a narrow spectral curve and "distinguish" colors. There is only one type of rods, and cones are divided into three types, each of which is sensitive to a certain range of wavelengths (long, medium or short.) Their sensitivity is also different.

On fig. 2.3 shows the cone sensitivity curves for all three types. It can be seen that the cones that perceive the colors of the green spectrum have the greatest sensitivity, the "red" cones are slightly weaker, and the "blue" cones are much weaker.


Rice. 2.2.


Rice. 2.3.

Thus, if the function characterizes the spectral decomposition of light radiation from a certain source (Fig. 2.4), i.e., the distribution of intensity over wavelengths, then three types of cones will send signals to the brain (red, green, blue), the power of which is determined by the integral ratios

where - sensitivity functions of the corresponding types of cones.


Rice. 2.4.

If the perceived light contains all visible wavelengths in approximately equal amounts, then it is called achromatic and at maximum intensity is perceived as white, and at lower intensities - as shades of gray. It is convenient to consider the intensity of reflected light in the range from 0 to 1, and then the zero value will correspond to black. If light contains wavelengths in unequal proportions, then it is chromatic. An object that reflects light is perceived as being colored if it reflects or transmits light in a narrow range of wavelengths. Similarly, a light source is perceived as colored if it emits waves in a narrow range of wavelengths. When a colored surface is illuminated with a colored light source, quite a variety of color effects can be obtained.

Color in computer graphics

Color is an extremely difficult problem for both physics and physiology, since it has both psychophysiological and physical nature. The perception of color depends on the physical properties of light, i.e. electromagnetic energy, on its interaction with physical substances, as well as on their interpretation by the human visual system. In other words, the color of an object depends not only on the object itself, but also on the source of light illuminating the object and on the system of human vision. Moreover, some objects reflect light (board, paper), while others let it through (glass, water). If a surface that only reflects blue light is illuminated with red light, it will appear black. Similarly, if a green light source is viewed through a glass that only transmits red light, it will also appear black.

The simplest is achromatic color, that is, the one we see on a black and white TV screen. In this case, objects that achromatically reflect more than 80% of the light of a white source look white, and less than 3% appear black. Intermediate values ​​give different shades of gray. The only attribute of such a color is intensity or quantity. Intensity can be associated with a scalar value, defining black as 0 and white as 1. Then the value of 0.5 would correspond to the mid-gray color.

If the perceived light contains wavelengths in arbitrary unequal quantities, then it is called chromatic. In the subjective description of such a color, three values ​​are usually used: hue, saturation and lightness. Hue allows you to distinguish colors such as red, green, yellow, etc. Saturation characterizes the purity, i.e. the degree of weakening (dilution) of a given color with white light, and allows you to distinguish pink from red, emerald from bright green and etc. In other words, saturation is a measure of how soft or sharp a color appears. Lightness reflects the idea of ​​intensity as a factor independent of hue and saturation.

Usually there are not pure monochromatic colors, but mixtures of them. The three-component theory of light is based on the assumption that in the central part of the retina there are three types of color-sensitive cones. The first perceives green, the second perceives red, and the third perceives blue. The relative sensitivity of the eye is maximum for green and minimum for blue. If all three types of cones are exposed to the same level of energy brightness, then the light appears white. Feeling white color can be obtained by mixing any three colors, as long as none of them is a linear combination of the other two. Such colors are called primary.

The human eye is capable of distinguishing about 350,000 different colors. This number was obtained as a result of numerous experiments. Approximately 128 color tones are clearly distinguishable. If only the saturation changes, then the visual system is no longer able to distinguish so many colors: we can distinguish from 16 (for yellow) to 23 (for red and purple) such colors. The results of the experiments are summarized in Grassmann's laws:

  • The eye responds to three different stimuli, which confirms the three-dimensional nature of color. As stimuli, one can consider, for example, the dominant wavelength ( color background), purity (saturation), and brightness (lightness), or red, green, and blue.
  • The four colors are always linearly dependent, i.e., cC = rR + gG + bB, where c, r, g, b are not equal to 0. Therefore, for a mixture of two colors, (cC)1 + (cC)2 = ( rR)1 + (rR)2 + (gG)1 + (gG)2 + (bB)1 + (bB)2. If the color C1 is equal to the color C and the color C2 is equal to the color C, then the color C1 is equal to the color C2, regardless of the structure of the energy spectra c, C1, C2.
  • If in a mixture of three colors one continuously changes, while the others remain constant, then the color of the mixture will change continuously, i.e. the three-dimensional color space is continuous.
In computer graphics, two primary color mixing systems are used: additive - red, green, blue (RGB) and subtractive - cyan, magenta, yellow (CMY). The colors of one system are complementary to the colors of the other: cyan to red, magenta to green, and yellow to blue. The complementary color is the difference between white and the given color.

The CMY subtractive color system is used for reflective surfaces such as printing inks, films, and non-luminous screens.

The additive RGB color system is useful for luminous surfaces such as CRT screens or color lamps.

Based on the materials of the book by Yu. Tikhomirov "Programming 3D Graphics"

Color in multimedia systems can be used as a code, or as a design tool. The color code is used to separate various kinds information displayed on the screen. For example, emergency messages operating system usually displayed on a red background.

As a means of design, color is used to attract attention, to psychologically influence the user: to create a certain mood, to excite the right emotions, to balance the screen, and just for decoration.

When working with color, designers use a special tool - color circle, which shows the relationship between different colors and illustrates their relationship to each other. Using the color wheel, you can select colors that blend well with each other, ensure the stylistic unity of the created document. The colors on the color wheel are arranged as follows: red 0 degrees; yellow - 60; green - 120; cyan - 180; blue - 240; magenta-360.

The nature of color was revealed by I. Newton and M.V. Lomonosov. Their experiments took place in a darkened room, in the wall of which a slit was cut through which a ray of sunlight penetrated. A glass prism was placed in the path of this beam. Passing through the prism, the sunbeam was decomposed into components: red, orange, yellow, green, blue, indigo and violet, which could be observed on the screen. Moving the screen aside, they put in its place a second glass prism, turned towards the first one, from which a white beam again came out onto the screen. This proved that white is made up of a large number of other colors. By placing strips of paper between the prisms, the researchers began to overlap individual colors, observing how the color of the beam would change at the output of the second prism. Thus, it was found that different colors are not the same in their capabilities. Groups of primary colors were identified, the mixing of which made it possible to obtain other colors. Greatest Opportunities possessed a group consisting of red (Red), green (Green) and blue (Blue) colors. By the first letters of the English names of these colors, the group was named RGB. Mixing these colors in different proportions made it possible to obtain any other shades of colors, including white. This group of colors subsequently became the main one in the production of color televisions and computer monitors.

Another group of primary colors has similar capabilities: CMYK - C yan, M agenta, Y ellow, black K(cyan or teal; cherry or magenta or magenta; yellow; and black). This group of colors has become widespread in printing and among artists. It is also the main one in computer output devices - color printers, for example, the CMYK group can be obtained from RGB due to the fact that red and green in the absence of blue form yellow (yellow), green and blue in the absence of red form cyan , red and blue in the absence of green - magenta, and complete absence all colors are black.

The triad of primary print colors: cyan, magenta and yellow ( CMY, without black) is, in fact, the heir to the three primary colors of painting (blue, red and yellow). The change in the shade of the first two is due to the chemical composition of the printing inks, which is different from the artistic ones, but the principle of mixing is the same. Both art and printing inks, despite their proclaimed self-sufficiency, cannot give very many shades. Therefore, artists use additional inks based on pure pigments, and printers add at least black ink (black color in computer output devices is formed due to absence of R, G and B or C, M and Y, respectively).

Colors obtained by mixing primary colors are called derivatives. Colors located opposite each other on the color wheel are called complementary.

Sometimes in graphic design use other color models that are not based on the composition of the primary colors, for example, the model HSB- Hue (hue), Saturation (saturation), Brightness (brightness), or HSL- Hue, Saturation, Lightness (illuminance). Brightness refers to the degree of proximity of a given color to white or black. It is measured in % of black or white mixed with the given color. (Screening is the operation of mixing a pure tone with black. For example, a blue color containing 40% black is twice as bright as the same blue color with 80% black).

Hue (color) determines how different a given color is from others. It is determined by the angle in degrees on the color wheel.

Saturation is a measure of the intensity of a color. The higher the saturation, the more vibrant the color appears. With low saturation, the color looks dark and dull. Saturation is measured (as well as brightness and lightness) as a percentage. A saturation of 100% defines a pure color. Saturation 0% defines white, black or gray colors.

Composing combinations of different shades and changing their brightness and saturation, you can get a variety of effects using just a few colors.

The HSB (HSL) system has an important advantage over other systems: it is more consistent with the nature of color, and is in good agreement with the model of human color perception. Many shades can be quickly and conveniently obtained in HSB or HSL, then converted to RGB or CMYK.

According to the emotional impact, most colors can be classified into one of two categories - warm or cold colors.

Warm tones create the effect of movement towards the viewer, seem closer, attract attention, and have an exciting effect. These include red, orange, yellow.

Cold tones seem to move away, create a sense of movement away from the viewer, can create a feeling of alienation and isolation, but can also be calming and encouraging. Cold colors include blue, blue, purple.

Green is neutral.

The effect of movement created by warm and cool colors is often used by designers when cool colors are chosen for the background, and warm colors for objects located in the foreground. In documents dominated by warm tones, cool colors can be used to create highlights and enhance contrast, and vice versa. By applying cool shades, you can emphasize the frivolity, elegance or rigor of the publication. Deep warm colors are exciting or convey a sense of closeness.

It should also be borne in mind that the background color can change the hue of the primary color and the impression it makes.

But colors have many different variations: cool colors have warm varieties, while warm colors have cold varieties. Therefore, the selection of colors is a creative process in which there are no unambiguous recommendations.

When using color codes (the so-called “visual guides”), it must be taken into account that an unprepared person cannot remember more than seven codes. Therefore, you should not get involved in the use of color codes. In addition, color coding must be consistent - within the same document, one electronic information system the same color codes to refer to the same phenomena and processes.

Various combinations of colors greatly affect the readability of the text. Text and background should contrast with each other. The stronger the contrast, the better the text is readable. In addition to the standard black text on a white background, black text on a yellow background and orange text on a white background are good combinations.

Color is a very powerful design tool that helps draw attention, direct the eye in the right direction, and keep the user interested. But in no case should the color scheme distract the user from the main content, conflict with it.

Hollywood movie quality provides for the possibility of placing on the screen at the same time about 20 million different colors. A pixel attribute, which is 1 byte long, allows 256 different colors to be encoded (VGA standard - Video Graphic Array). The 15-bit SVGA (Super VGA) board attribute allows 32,768 colors to be displayed simultaneously (5 bits for each color encoding - 32 different shades for red, blue and green, i.e. 32 × 32× 32 = 32768). The 24-bit attribute of special graphics cards (Silicon Graphic, Indy R4000, Targa, etc.) allows you to display on the screen simultaneously

256× 256× 256 = 16777216 colors.

These are the capabilities provided by display adapters (video cards). But in order to display so many colors on the screen at the same time, you need to have at least one pixel for each color on the screen. And at standard resolution, the monitor screen contains 640 × 480 = 307200 pixels. more It is physically impossible to get colors on such a screen.

If the adapter allows you to work with 24-bit color coding, and the monitor screen cannot perceive such a number of colors, you have to work with palette- a limited set of colors corresponding to the capabilities of the screen. The colors on the palette can be changed. But at the same time, it must be remembered that when playing on another computer, the colors may be distorted if another palette is loaded in the color table of this computer.

Problems with palettes arise when the correct color rendering of computer graphics is achieved on different computers (for example, when using the multimedia system being created on the WWW). If you have an image containing millions of colors, then for correct color reproduction in WWW conditions, you need to reduce the number of colors to 256.

The Internet still uses the Index Color color model, which works on the principle of 8-bit color. It works on the basis of creating a palette of colors. All shades in the file are divisible by 256 options, each of which is assigned a number. Further, based on the resulting color palette, a table is built, where each cell number is assigned a color tint in RGB values.

Color reduction is performed using the dithering operation. Color cliching is the process of changing the color value of each pixel according to a certain algorithm to the nearest color value from the available (installed) palette.

Liked the article? Share with friends!
Was this article helpful?
Yes
Not
Thanks for your feedback!
Something went wrong and your vote was not counted.
Thanks. Your message has been sent
Did you find an error in the text?
Select it, click Ctrl+Enter and we'll fix it!