JPEG2000 comparison

In response to the recent publicity about the supposedly superior compression performance of JPEG2000, I decided to do a little testing myself. This page shows why I'm not impressed.

Basically, it's well known that JPEG performs rather poorly at high compression ratios. Among other things, it quantizes the color levels, showing Mach bands, and you also see the 8x8 block edges clearly. I'll grant JPEG2000 that they solved these problems at high compression ratios.

The outstanding issue, though, is whether you care about high compression ratios. I argue that we shouldn't. Simply downsampling the image reduces the number of bytes very significantly, and can be compressed quite well at medium compression with standard JPEG. I'll demonstrate this with an example.

The example image is taken from the NexImage page. Here's a link to the original ppm file. Also, Phil Howard was kind enough to convert this image to a true color GIF for easy viewing in web browsers. Yes, there is such a thing!

All of the further examples on this page are for 96:1 compression, ie an approximately 8k target file. I have recompressed the images in high quality jpeg (libjpeg 6b, quality 90 with optimized Huffman tables) to save download time, as this page is on a DSL. I have confirmed visually that they closely match the originals.

The above image is the image displayed by the NexImage java applet for 96:1 compression. The actual image is the result of a screen grab at 24bpp, then recompressed at quality 90. (Note: an earlier version of this page had a screen grab taken at 16bpp, which added subtle artifacts to the image)

I will take their word that the compression ratio is approximately 96:1.

The above image is the comparison JPEG image on the NexImage site. The file size is 8268 bytes, or a compression ratio of 95.1:1. Close enough.

The above image is my independent re-encoding of the image using libjpeg6b, quality level 12, optimized Huffman tables. The file size is 8185 bytes, or a compression ratio of 96.1:1, just slightly better than the NexImage encoding.

This image is quite a bit better quality than the NexImage comparison, which raises the question of whether the comparisons are anywhere close to fair.

This image is the result of scaling the original in half using Gimp with cubic interpolation, then encoding with libjpeg6b, quality level 53, optimized Huffman tables. The file size is 8188 bytes.

The same image as the last one, scaled up 2x with the Gimp (also using cubic interpolation). Thus, the file size is 8188 bytes. I recompressed the scaled up version using quality level 90, and confirmed visually that it is indistinguishable from the pure scaled-up version.

This image demonstrates that reducing the resolution of the image before JPEG compression is an effective technique. The compression ratio from the scaled down image is only 12:1, well within JPEG's "sweet spot."

Compare this image carefully with the JPEG2000 version. Which is better? To me, it's a tossup. The JPEG2000 version has less chroma-bleeding artifacts, a definite limitation of JPEG, and is also smoother. However, the diagonal stripes to the right of the tennis racket are rendered much more clearly in the JPEG version. I also find the JPEG version to be more consistent in its level of detail and artifacting. In the JPEG2000 version, some areas of the image seem very out-of-focus, while others (such as the red cherry/green grape boundaries) are relatively clear. I prefer the consistency, but that may be a matter of individual taste.


At medium and low compression ratios, a good quality implementation of standard JPEG performs quite well. At high compression ratios, the performance is not so good, but these problems can be mitigated by simply scaling the image down prior to encoding.

Comparison tests between standard JPEG and JPEG2000 may be strongly biased in favor of JPEG2000. The NexImage comparison in particular suffers from two problems: inferior JPEG encoder for comparison, and inappropriately high compression ratios. When these biases are removed, the quality advantage of JPEG2000 over JPEG becomes quite thin.

-- Raph Levien, 3 Jan 2000 gimp home