Different Data Types and File Formats of Images


There are different types of images based on pixel sizes etc,. Also, there are many file formats for images. In this article, I discuss about most of the datatypes and some of the file formats of images.

Introduction


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.

Image 5x5

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.

Data Types


The commonly used Image Data Types are as follows.

1-bit Image


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.
  1. Select a block of the image which consists of almost all colours in the image.
  2. Apply median-cut algorithm and note the median as the first entry in the colour lookup table.
  3. Repeat the process and complete the colour lookup table.


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.
  1. For every 24-bit colour value in the image, find an entry in the colour lookup table such that the Euclidean distance is least.
  2. Replace the 24-bit colour value with the 0-255 value in the colour lookup table entry just found.


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.

File Formats


This is the list of some of the file formats of images.
  1. GIF : It stands for Graphics Interchange Format. This format is used to store 8-bit colour images. There are two versions of GIF called GIF87a and GIF89a. The latter is used for animated GIFs.
  2. JPEG - It stands for Joint Photographic Experts Group. It is also represented as JPG. It uses a lossy compression technique (some colours lost but difference cannot be found by human eye) to store images. Its extension is JPEG2000 standard which supports both lossy and lossless (nothing is lost) compression techniques.
  3. PNG - It stands for Portable Network Graphics. It is created as an open-source alternative to GIF. In addition to GIF, it supports 24-bit colours and 48-bit colours also.
  4. BMP - It stands for Bit MaP. It is used in Microsoft Windows Operating Systems. Due to its simple structure, it is accepted even though it supports lossless compression and occupies more memory.


    1. 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,.


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: