We must have heard the terms JPEG and GIF with respect to file formats. JPEG and GIF are the file formats which provide standards compression techniques for storing photographic images and mainly differ in the representation and the storage of the images where the JPEG can support and display single full photographic image within a file while GIF is comprised of multiple images in a single file. JPEG images are opaque while GIF images are partially transparent.
Content: JPEG Vs GIF
|Basis for comparison
|Joint Photographic Experts Group
|Graphics Interchange Format
|Can store a single image in a file.
|Multiple images can be stored in the file.
|Photographs, complex graphics with several range colours, file size reduction.
|Small animation, web graphics with few colours, icons, line drawings, cartoons, black and white images.
|More than 16 million colours
|Maximum of 256 colours
|Single bit transparency is permitted
Definition of JPEG
You must have come up with the “.JPG or .JPEG” extension of a file sometime. JPEG stands for the Joint Photographic Experts Graphics is an organization produced a standard for compressing images in accordance with the authority of international standards bodies. It provides an algorithm to manipulate and display full-colour photographs. However, it is complex, along with defining an image file format it also describes a number of connected image compression techniques.
It is the best format for the photographic images and provides the highest compression of any bitmap compression generally used. For example, in Windows BMP file a photograph consuming 1 MB size can be compressed to 50 KB of JPEG. However, it is said to be computationally intensive as its good compression technique overbalance the processing needs. The compression technique is lossy which means there is some amount of the data is lost each time the image is compressed, this is the biggest demerit of the technique although the lossless mode of JPEG is also available.
Now let’s understand how does it work. Our eyes can not observe the extremely minute details, and the human vision system is limited to some extent, this is advantageous for JPEG to obtain high rates of compression. So, the image is not much affected if any change is applied to few pixels and that image is said to having a high spatial frequency (means an extensive change in (x,y) space).
Therefore, the colour information in JPEG is decimated (partially dropped or averaged), in this way the tiny blocks of the image are presented by a spatial frequency domain (u,v), instead of (x,y). The new image is created by a combining the coefficients weights of the speed, where the speed of alteration in x and y is examined as low to high.
Definition of GIF
GIF expands to graphics interchange format is also a file format for storing the images. However, it can support animation in a limited way. UNISYS Corporation and Compuserve are the organizations behind the development of the GIF in which the graphical images can be transmitted over telephone lines through modems. The major algorithm used in it is the Lempel-Ziv-Welch algorithm. The generation and editing of GIF can be done in two ways – lossy and lossless.
GIF only allows 8-bit (256) colour images which produce acceptable colour and appropriate for images having distinctive colours. Another special feature supported by GIF is the interlacing where the pixels in a widely spaced rows are displayed in a sequential manner according to a four pass display process.
There are two variants of GIF, the original one is GIF87a and the later version is GIF89a. The later version is capable of rendering simple animation through a Graphics control extension block in the data. This offers simple control upon delay time, a transparency index, and so on. The software such as Corel Draw provides the editing of GIF images.
The standard specification of GIF file format is displayed below. It contains 6 bytes of signature, 7-byte set of flags as a screen descriptor, multiple image definitions can also be present to fit on several distinct parts of the screen. Hence, every image can hold its colour lookup table, a local Color Map, for mapping 8 bits into 24-bits RGB values. Here the screen descriptor contains a group of attributes that pertain to every image in the file.
Key Differences Between JPEG and GIF
- The JPEG expands for Joints Photographic Experts Group while GIF stands for Graphics Interchange Format.
- Several images can be stored in GIF but JPEG only allows a single image.
- The JPEG format offers 16 million colours in an image. As against, GIF only supports 256 colour images.
- JPEG provides zero transparency whereas in GIF limited transparency is implemented.
- JPEG is majorly lossy where the redundant information is eliminated to reduce the size of the file. In contrast, GIF is lossless, however, is can produce grainy effect image due to limited colours.
- There is no provision of animation in JPEG format, while GIF support animation too.
Advantages of JPEG
- Compresses the image and the size at a higher extent.
- The degree of compression is can be easily controlled.
- All browsers, text editors provide JPEG support and compatibility.
- When the compression ratio is low the quality of the photo will be enhanced.
Advantages of GIF
- It supports animation.
- Employs LWZ lossless compression.
- Compresses the picture by translating the picture definition into 256 colour.
- Supports partial transparency.
Disadvantages of JPEG
- The excessive compression of the image can result in the scattering of the image.
- Inefficient while working with texts and monochrome graphics picture as it does not create smooth edges.
- No transparency is provided.
- It is not suitable for editing of images because it degrades the quality of the image.
Disadvantages of GIF
- The limited transparency is unable to create even images.
- Animation can cause the increment in the size of the file.
- The compression does not much affect the size of the picture and produces a grainy effect.
- Inappropriate for images storage comprised of multiple layers and vector graphics.
The JPEG and GIF are the file formats for the photographic image. However, the JPEG does not support animation, but GIF supports it.