Image Compression with Wavelets
Thursday, August 8, 2002

Download

Download the demo (Win98/NT/2000).
(standard disclaimer applies: I'm not responsible for damage, disembowelment, or dysfunction resulting from use of this program. I make no guarantee of usability for any particular purpose. Use at your own risk.)

Instructions

  1. Press the Load bmp button, then select a bitmap file (must be 512x512).
  2. To save a wavelet-compressed image, enter a threshold (try 4 to begin with) and press the Save qck button.
  3. To view a previously-compressed .QCK file, press the Load qck button.

Play around with different threshold values to explore the tradeoff between image quality and compression efficiency. Look at the console to see the compression efficiency after saving a .QCK file.

Details

The image displayed after you save a .QCK file is the wavelet image pyramid, a visual representation of the compression structure. The higher you set the threshold, the fewer "specks" you'll see in this picture.

To see the nature of this particular wavelet decomposition, observe how higher compression results in a blockier image in the following compressed pictures:

Original image 5x compression
(threshold = 4)
6x compression
(threshold = 8)

This is an artifact of the particular wavelet function used (it looks like a square-wave). The compression quality breaks down the most in regions of low-frequency (like the smooth wavey background near James Dean's neck), while high-frequency details are mostly preserved (i.e., details around the eyes).

The compression algorithm uses a Haar decomposition to generate wavelet coefficients. These are quantized, selectively thresholded, and passed through a Huffman coder.

Notes

See Also:

Charles Bloom's Image Compression page

Updates

(Monday, August 19, 2002): Michael Pote suggested applying a bilinear filter to the images after decompression. Another approach would be to flag different decomposition levels and do multiresolution blurring of those that are flagged. This way, images that are supposed to be blocky aren't affected by the smoothing operation, and smoother images compress better.

(Tuesday, August 13, 2002): This program was featured on Flipcode's Image of the Day Gallery. Click here to see a screenshot of the program in action.