# Computer Graphics | The RGB color model

The RGB color model is one of the most widely used color representation method in computer graphics. It use a color coordinate system with three primary colors:

R(red), G(green), B(blue)

Each primary color can take an intensity value ranging from 0(lowest) to 1(highest). Mixing these three primary colors at different intensity levels produces a variety of colors. The collection of all the colors obtained by such a linear combination of red, green and blue forms the cube shaped RGB color space.

The corner of RGB color cube that is at the origin of the coordinate system corresponds to black, whereas the corner of the cube that is diagonally opposite to the origin represents white. The diagonal line connecting black and white corresponds to all the gray colors between black and white, which is also known as **gray axis**.

In the RGB color model, an arbitrary color within the cubic color space can be specified by its color coordinates: (r, g.b).

**Example:**

(0, 0, 0) for black, (1, 1, 1) for white, (1, 1, 0) for yellow, (0.7, 0.7, 0.7) for gray

Color specification using the RGB model is an **additive process**. We begin with black and add on the appropriate primary components to yield a desired color. The concept RGB color model is used in **Display monitor**. On the other hand, there is a complementary color model known as **CMY color model**. The CMY color model use a **subtraction process** and this concept is used in the **printer**.

In CMY model, we begin with white and take away the appropriate primary components to yield a desired color.

**Example:**

If we subtract red from white, what remains consists of green and blue which is cyan. The coordinate system of CMY model use the three primaries’ complementary colors:

C(cray), M(magenta) and Y(yellow)

The corner of the CMY color cube that is at (0, 0, 0) corresponds to white, whereas the corner of the cube that is at (1, 1, 1) represents black. The following formulas summarize the conversion between the two color models:

## Recommended Posts:

- Computer Graphics | Antialiasing
- Segments in Computer Graphics
- Applications of Computer Graphics
- Translation of objects in computer graphics
- Display Processor in Computer Graphics
- DDA Line generation Algorithm in Computer Graphics
- Point Clipping Algorithm in Computer Graphics
- 2D Transformation in Computer Graphics | Set 1 (Scaling of Objects)
- Draw a moving car using computer graphics programming in C
- Refresh type output devices in Computer Graphics
- Window to Viewport Transformation in Computer Graphics with Implementation
- Computer Graphics | Cathode ray tube (video display device)
- bar() function in C graphics
- Draw a line in C++ graphics
- How to include graphics.h in CodeBlocks?

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.