|
|
JPG compression algorithmJpgs are high color images. In order to compress such images, it is natural that some information has to be discarded. The lossy compression algorithm that JPGs employ does cast off some information. However, this is not perceptible to the human eye. (Here they go taking advantages of our shortcomings!) The JPG images are very well suited for the Web. Bitmaps (.bmp), TIFF and other high color image formats can be compressed 10 to 20 times (and sometimes even more) when saved as Jpgs. How does the JPG compression algorithm do it?Images that contain smooth gradients and subtle color variations are compressed substantially. Any sharp edge in the image is not resolved well by JPG compression leading to higher file sizes. Images such as text or line art, contain lots of sharp edges and are more suited for the GIF compression algorithm. JPG compression algorithm makes images more complexIf an image has areas of flat color or very sharp color changes the JPG algorithm tends to replace some color pixels to make the image more complex. Once a simple image has been made more complex by addition of extra color pixels, the algorithm can work out a better compression for it. Take a look at the following Gif image. This is a simple image with some areas of single flat color and sharp edges (or sharp color changes across areas) and is ideally suited to be saved as a GIF. Now if we saved the same image as a JPG, not only will the file size increase but the clarity will also come down - Refer images below. If we magnify the JPG version of this image, you'll notice that the JPG algorithm has placed pixels of additional colors, especially, near the edges to make the image more complex so that it can work out a good compression for the graphic.
Finally, if we have images with subtle color gradients, the JPG compression algorithm can preform wonders. In fact, images with color gradients (complex images) when saved as JPGs come out better than Gifs - refer image below.
You might also like to read - When to use Gifs and when to use JPGs for images, When to save images as Gifs and When to save images in the JPG format.
Page contents: What is the JPG compression algorithm and how it compresses high color images. This is a lossy compression algorithm.
Page URL: http://www.webdevelopersnotes.com/graphics/ jpgs_compression_algorithm.php3
|
|