This site is devoted to mathematics and its applications. Created and run by Peter Saveliev.

RGB color model

From Mathematics Is A Science
Jump to navigationJump to search

RGB stands for Red, Green, and Blue. These are the "channels" in a color image. Each pixel has 3 numbers between 0 and 255 assigned to it.

  • (255,0,0) red,
  • (0,255,0) blue,
  • (0,0,255) green,
  • (255,255,0) yellow,
  • (255,0,255) magenta,
  • (0,255,255) cyan,
  • (g,g,g) gray, for any g,
  • (0,0,0) black,
  • (255,255,255) white

AS the image on the right suggests, the colors can be thought of as mixtures of the three primary color. A more mathematical interpretation is a 3-dimensional space with primary colors serving as its basis.


In the example below, the circles are of pure red, green, and blue. As a result, the red circle which is (255,0,0) becomes 255 in the red channel. But 255 is equivalent to white in this gray scale image. So the red circle disappears in the red channel. Similarly, the green circle will disappear if you choose the green channel, etc.

Channels2.JPG Channels3.JPG Channels4.JPG

For more see the Wikipedia article.

A better choice is to analyze all three channels as a whole, see Color images.