An image can be defined as a collection of pixels. Each pixel has a value which determines what its colour is. That value is called pixel value. The following figure shows an example arrangement of pixels in an image.
The above figure shows a 5x5 image having 25 pixels i.e. 5 rows of 5 pixels each. Such images (small like 5x5) are not used practically. It is shown only for understanding. The memory occupied by pixel value is called pixel size. Hence, the image size is the product of number of pixels and the pixel size.
The commonly used Image Data Types are as follows.
Images having pixel size of 1-bit are called 1-bit images. A 1-bit number in base 2 corresponds to 0 or 1 in base 10. Hence, pixel value can be either 0 or 1. Here, 0 indicates black colour and 1 indicates white colour. Therefore, the image can have only the two colours pure black and pure white. These are not used much now-a-days.
8-bit Gray Scale Images
Images having pixel size of 8-bits are called 8-bit images. An 8-bit number in base 2 corresponds to 0 to 255 in base 10. Hence, each pixel value varies from 0 to 255. The values 0 to 255 are assigned to 256 different shades of gray where 0 is pure black and 1 is pure white. Such images are called 8-bit Gray Scale Images.
24-bit Colour Images
Images having pixel size of 24-bits are called 24-bit colour images. The primary colours are Red, Green and Blue. So, every other colour is a combination of these three colours. Considering 256 different values for each of Red, Green and Blue i.e. 8-bits for each of R-value, G-value and B-value, a pixel occupies 24-bits. These are useful but needs modification as they occupy much space.
8-bit Colour Images
Images having pixel size of 8-bits are called 8-bit images. It is clear that a 24-bit colour image occupies large amounts of space. Hence, it is necessary to convert them to 8-bit images preserving the colour. For this purpose, colour lookup tables are introduced. A Colour Lookup Table has 256 entries. Each entry consists of a number in 0 to 255 and a 24-bit colour value (8-bit R-value, 8-bit G-value, 8-bit B-value). The method for constructing a colour lookup table for an image is as follows.
Now that the colour lookup table is constructed, the 24-bit colour image should be converted into an 8-bit image. The method for that conversion is as follows.
Here, Euclidean distance is nothing but the difference between two colours. Hence, a 24-bit colour image is converted into an 8-bit image thereby reducing the memory occupied and also preserving the colour. Such images are called 8-bit Colour Images.
This is the list of some of the file formats of images.
Some other file formats are TIFF (Tagged Image File Format), EXIF (EXchangeable Image File Format), HEIF (High Efficiency Image File Format), BPG (Better Portable Graphics) etc,.