Earlier in the month, a blogger provided an informative overview of the widely used JPEG image compression format (see post, “A brief overview of Jpeg”). It should however be noted that the JPEG format is not good at compressing all types of images, such as images with text. For example, JPEGs tend to create excessive artifacts around text that maybe present in an image, such as in the example below:
The above example is a screen shot of a tab in the Firefox web browser, zoomed at 300%. The top image is the JPEG version of the screen shot saved at a quality of 75%, while the bottom screen shot is the PNG version. Notice the graininess in the background behind the text in the JPEG version. These are the artifacts that result from the JPEG compression process. These artifacts do not exist in the PNG version. Now, in most cases, image files compressed using PNG are usually larger than when compressed using JPEG. However, in this case the PNG version of this screen shot image is slightly smaller than the JPEG image (2.61 KB vs. 2.65 KB, for comparison, a 32-bit bitmap version if this image is 29 KB in size).
Why does PNG compression produce a more desirable image in the above example than a JPEG? The answer is that the most widely used JPEG compression routine uses a “lossy” compression algorithm, meaning it throws out parts of the original image in order to make the resulting image smaller. The same holds true for the SVD Image Compression algorithm described in an earlier post (see SVD Application: Image Compression). These two algorithms look at the image in terms of matrices and manipulate the matrices in some way as to reduce the size of the resultant matrix.
PNG uses a lossless algorithm that does not throw out any of the information from the original image, allowing the original image to be recreated from the compressed image in its full glory. PNG uses the DEFLATE method, which uses both Huffman coding and LZ77 compression. These algorithms do not view the image as a matrix and thus do not rely on linear algebra techniques. Instead, they look at the data directly (the bits) for repeating patterns that can be replaced by smaller bit patterns. Thus no data is ever removed from the image, its representation is just shrunk. As an aside, the DEFLATE method can also be used to compress any file format, not just images (as it looks at the binary representation of the data).
In conclusion, not all image compression formats involve algorithms that manipulate matrices in order to get the job done. In the example above, we ended up with a image that was smaller than its JPEG counterpart that retained the full quality of the original. If you are willing to sacrifice the possibly large reduction in size that you get from a lossy image compression format for the full quality of the image but less reduction in image size, consider using the PNG image format.
References:
The PNG image format article on wikipedia : http://en.wikipedia.org/wiki/Portable_Network_Graphics
A brief overview of the DEFLATE algorithm: http://zlib.net/feldspar.html







Leave a Comment
You must be logged in to post a comment.
* You can follow any responses to this entry through the RSS 2.0 feed.