Saturday, July 19, 2008

JPEG image compression technique


I just completed reading the official FAQ of JPEG from faqs.org. JPEG is actually 'lossy' image standard widely used for compression of images. It stands for Joint Picture Experts Group which is the team who wrote this standard image file format from IETF.JPEG is mostly compared to GIF which has its own advantages and disadvantages over jpg.
The major problem associated introduction of with JPG was that the original group who worked behind the JPG format could not lay down a "standard" format due to certain internal limitations. Therefore major vendors manipulated the technologies behind the compression system to their own will even though basics remained the same.

JPEG uses the limitations of human eye such as inability to differentiate hue changes than changes in brightness. So a JPEG image scanned using a machine or software is likely to find errors but when viewed through human eye, it is almost unable to distinguish between the original image and compressed image. This make JPEG a lossy standard. But this small loss is compensated by the compression ratio. A JPG image is compressed to a ratio of 1:20 without visible changes in quality. If ready to give up a little details, one can compress this to 1:50 or even more. This makes JPG the favorite standard of web masters. Because during transmission over a network priority is transmission time rather than image quality. Since compression ratio is more, a JPG can be transmitted over internet with greater speed.
Unlike GIF, which holds 8bit data per pixel, JPEG holds 24bit. So that converting a true 24 bit data into a web standard image format is more viable with JPG. Experts say that GIF is very likely to be extinct in near future.

JPG compresses cartoon or black and white images poorly compared to GIF which is a limitation of JPG. Another problem arises when the sharp edges occurs. Dithering can take place at sharp edges in a jpg image.

JPG losses more data with repeated compression and decompression. So one should never try to compress a file that was once compressed.

There are two types of JPG mainly. They are baseline and progressive. In baseline all the image is read at once by the decoder. This make the image visible at once. But in a progressive one each image is split into various sections and are scanned differently. So for a viewer, it would seem that a progressive scanning results in faster loading but actually the time taken to completely view the file is same.

A JPEG file can not be made transparent at specific locations in a file unlike GIF. This is because of the fact that JPG is a lossy format.


No comments: