There are several different color models, but the most common one is the Red, Green, Blue (RGB) model, which will be used to explain some key concepts concerning digital images.
In Chapter 5, Image Processing Techniques, the main color models (also known as color spaces) will be fully explained.
The RGB model is an additive color model in which the primary colors (R, G, B) are mixed together to reproduce a broad range of colors. As we previously stated, in the RGB model, the primary colors are red, green, and blue.
Each primary color, (R, G, B), is usually called a channel, which is commonly represented as an integer value in the [0, 255] range. Therefore, each channel produces a total of 256 discrete values, which corresponds to the total number of bits that are used to represent the color channel value (28=256). Additionally, since there are three different channels, this is called a 24-bit color depth:
In the previous diagram, you can see the additive color property of the RGB color space:
- Adding red to green gives yellow
- Adding red to blue produces magenta
- Adding green to blue generates cyan
- Adding all three primary colors together produces white
As we previously stated and in connection with the RGB color model, a specific color is represented by red, green, and blue values, expressing the pixel value as an RGB triplet, (r, g, b). A typical RGB color selector in a piece of graphics software is shown as follows. As you can imagine, each slider ranges from 0 to 255:
You can also see that adding pure red to pure blue produces a perfect magenta color. You can play with the RGB color chart at https://www.rapidtables.com/web/color/RGB_Color.html.
An image with a resolution of 800 × 1,200 is a grid with 800 columns and 1,200 rows, containing 800 × 1,200 = 960,000 pixels. It should be noted that knowing how many pixels are in an image does not indicate its physical dimensions (one pixel does not equal one millimeter). Instead, how large a pixel is (and hence, how large an image will be) will depend on the pixels per inch (PPI) that have been set for that image. A general rule of thumb is to have a PPI in the range of [200 - 400].
PPI = width(pixels)/width of image (inches)
PPI = height(pixels)/height of image (inches)
So, for example, if you want to print a 4 × 6 inch image, and your image is 800 × 1,200, the PPI will be 200.
We will now look into file extensions.