Image Processing — Types of Image Formats.
Hi guys, in the amidst of Covid-19, let’s discuss about something different which we use daily but many of us don’t have an idea why do we do it.
Today I am going to speak about the different types of image formats which we use in our day to day life.
Sometimes, we download the image as JPEG and sometimes as PNG but very few of us know the exact difference between these various image formats.
So, Let’s Begin,
- Joint Photographic Experts Group or JPEG : It is the most popular file format for photographic quality image representation. It is capable of high degrees of compression with minimal perceptual loss of quality. The compression algorithm of JPEG, I will discuss in another of my tutorial on image processing. For now we should keep in mind there are four compression modes in JPEG: Lossless, Hierarchical, Progressive and Sequential.
Now let’s dive into the details of JPEG format. The striking feature of JPEG is that it doesn’t specify the what an application needs to do in order to create images that can be exchanged among different applications. For example, it says nothing about how colors are represented, but deals only with how component values are stored. Nor is there any definition of how the components values are mapped within a color space. An implementer of JPEG software is not told if component one is red, two is green, three is blue, or even if the RGB color model is used at all. Color independent makes JPEG flexible to use. Integers in JPEG files are stored with the most significant byte first.
In my upcoming tutorials I will write a detailed tutorial only on JPEG.
2. Portable Network Graphics or PNG : It is the second most popular image format after JPEG. One problem with JPEG was inefficiency of compression of certain types of images and with the licensing of GIF, PNG formats attained popularity within a very short time. The PNG format uses a lossless compression process up to 48 bits per pixel in color images with a sophisticated color matching scheme. The PNG format stores multi-byte integers with the most significant byte first. Bit strings are read from the least to the most significant bit. When a bit string crosses a byte boundary the bits in the second byte are the most significant. A PNG file is organized into a sequence of blocks referred to as chunks in PNG standard. Let’s discuss chunk in a bit details as chunks are the heart of PNG format.
PNG chunks are given unique names that consist of four ASCII letters. The first, second and last characters in a chunk type can be either upper or lower case. The
case used for these characters follows the convention which allows a decoder to determine information about the chunk from the name alone. The third character in the chunk name must be in upper case. If an application encounters a chunk type containing any values other than ASCII letters, it should consider it invalid.
Chunk naming scheme is an important parameter to keep in mind.
- First character: It stands for critical or non-critical. The lower case resembles non-critical and upper-case resembles critical.
- Second character: The second character stands for public or private. Uppercase resembles public and lower case resembles private.
- Third character: It should always be in uppercase and it is a reserved character.
- Fourth Character: It stands for safe to copy or not. Lowercase resembles safe to copy and upper case resembles not safe to copy.
PNG supports five types of color representation.
- RGB Triple
- Palette
- Grayscale
- RGB with Alpha Channel
- Gray Scale with Alpha channel.
The monitors of our personal computer rarely include the RGB colors with the documentation but it is a important parameter while buying our monitor.
I will discuss the mathematics and decoding of PNG file in my upcoming tutorials on Image Processing.
3. Windows BMP : It is the native image format in the Microsoft Windows operating systems. It supports images with 1, 4, 8, 16, 24, and 32 bits per pixel, although BMP files using 16 and 32 bits per pixel are rare. BMP also supports simple run-length compression for 4 and 8 bits per pixel. However, BMP compression is of use only with large blocks with identical colors, making it of very limited value. It is rare for Windows BMP to be in a compressed format. Multi-byte integers in the Windows BMP format are stored with the least significant bytes first. Data stored in the BMP format consists entirely of complete bytes so bit string ordering is not an issue.
BMP supports two types of color representation
- RGB Quad
- RGB Triple
If you are developing software to read and write graphics files in the Windows
environment, Windows BMP is your best choice to use for testing. It is simple to implement, easy to debug, and can be viewed without special tools.
Unlike all of the other formats in this book, the definition of Windows BMP
is under the complete control of one company.
4. Graphics Interchange Format or GIF : It was the mostly widely used image format for storage before JPEG came into scenario. Firstly, this format can store up to 256 colors using 1 to 8 bits per pixel and secondly it can store multiple images per file. JPEG had successfully replaced GIF but due to legal licensing GIF has gone to obsolescence. I am not going to discuss GIF much because it is not used as image format now rather I am going to speak about the Animated GIF. Unlike all the other formats, GIF allows multiple
images to be stored in a single file. Web browsers have taken advantage of this
capability to store simple animations. There is no official standard that describes how multi-image GIF files should be displayed. Many image viewers will just display the first image in a GIF file. However, among the major Web browsers, there is some consistency in how GIF animations are displayed.
5. Tagged Image File Format or TIFF : It is a more sophisticated format with many options and capabilities, including the ability to represent truecolor (24 bpp) and support for five different compression schemes. It is a standard file format that is largely used in the publishing and printing industry.
In the case of photographic images, TIFF makes use of the Lempel-Ziv-Welch lossless compression method. TIFF files can be either compressed or uncompressed but are significantly larger than JPEGs and hence consume more space. However, this format has a few advantages over the JPEG format, such as the ability to store multiple layered images under a single TIFF file and to use a bit depth of 8 bits per channel or 16 bits per channel. Again, free exchange is possible between computer platforms and applications that use TIFF. It has a few drawbacks. One of them is the lack of mechanism to specify the multi-layer relationships between different TIFF pages. Also, in some ways, it lacks standard support for advanced imaging capabilities. Another major drawback lies in the size limitation. As the format makes use of 32-bit offsets, the file size is limited to 4 gigabytes.
So these are the top five image formats which we use daily. I hope the readers now have a intuition about the different image formats. Other than these major five image formats there are some others such as XCF (the native image format of the GIMP image editing program) and RAW (which is a family of formats mostly adopted by camera manufacturers).
I hope you loved this blog and in the upcoming weeks I will discuss about the various mathematics behind the JPEG and PNG.
For any suggestion or query feel free to mail me. My email id is subhamkundu999@gmail.com.
References
- For more details about the formats visit their respective wikipedia pages.
- Practical Image and Video Processing by Oge Marques, Florida Atlantic University.