Baseline JPEG and JPEG2000 Artifacts Illustrated

Copyright (c) Aleks Jakulin, 2002-2004
home
 

In this article, I will discuss the distortions caused by lossy image compression. There is a lack of independent JPEG2000 coverage: almost all materials currently available on the WWW are by the members of the JPEG committee, so I will try to elucidate the differences between the old ubiquitous baseline JPEG image storage format and the recent JPEG 2000 (JPEG2000, JPEG2k, JP2, JPX, etc.).

What are artifacts? There are two kinds of image compression today: lossy and lossless. Lossy image compression takes advantage of limitations of human visual system and throws away some information which people anyways wouldn't easily see. This way we achieve better compression, but the original and the decompressed files are no longer the same. Were we lossily compressing text, we could replace all appearances of "Coca Cola" and "Pepsi Cola" with "Cola", without losing any interesting information for most people. Lossy image compression does something similar with images. Sometimes the distortions are striking enough to be visible, and those are called artifacts.

Lossless image compression (in image formats such as GIF, PNG, JPEG-LS, TIFF, PCX, IFF) attempts to retain absolutely all the information present in the original image. You wouldn't like throwing files out of your medical records to save space, would you? Also, there are many images in science which get analyzed by computers with no human visual system hindrances.

 

Blocking artifacts:

Baseline JPEG can only work with 8x8 blocks, one at a time. This causes the best known artifact in compressed images - small square blocks all over the images, known both in JPEG and in video decoders. The wavelet transforms in JPEG2000 are no longer limited to fixed-size blocks. Although JPEG2000 supports optional tiles (but for a different purpose - handling very large images), they're rarely used, as they too cause noticeable blocking artifacts. 

JPEG2000
0.5 bits/pixel
1:48 compression ratio

Original



JPEG
0.5 bits/pixel
1:48 compression ratio

 

Color distortion:

As human eyes are not as sensitive to color as to brightness, much of the detailed color (chrominance) information is disposed, while luminance is retained. This process is called "chroma subsampling", and it means that a color image is split into a brightness image and two color images. The brightness (luma) image is stored at the original resolution, whereas the two color (chroma) images are stored at a lower resolution. The compressed images look slightly washed-out, with less brilliant color. This problem appears to be worse in JPEG than in JPEG2000: but beware - the images below were of different file size. 

JPEG2000

Original

JPEG

 

Ringing artifacts:

Both JPEG2000 and JPEG operate in spectral domain, trying to represent the image as a sum of smooth oscillating waves. Spectral domain is appropriate for capturing relatively smooth color gradients, but not particularly appropriate for capturing edges. So, instead of capturing an edge as such, both methods attempt to fit a wave function to it, as the image below illustrates: 

JPEG2000
928 bytes

Original
389 bytes

JPEG
898 bytes

The pictures below illustrate the breakdown of otherwise effective edge capture in JPEG2000. The main effect are the disturbing short vertical and horizontal "ridges" in the image. Baseline JPEG suffers from a similar problem, worsened by serious blocking artifacts.

JPEG2000
0.5 bits/pixel
1:48 compression ratio

Original

JPEG
0.5 bits/pixel
1:48 compression ratio

A particularly good example of ringing artifacts is compression of images with sharp edges, especially text, diagrams and line drawings. It is outright puzzling why so many websites use JPEG (Joint PHOTOGRAPHIC Experts Group) compression for such images. There are custom methods for compression of such data, such as JBIG and DjVu, but they are not supported by most image viewing applications. A somewhat more common format is the FAX compression mode in the TIFF standard, but still not enough for widespread use on the WWW. The method I personally use most often are 16-color grayscale PNG images. A section of text of size 787x392 was compressed to 26,823 bytes with PNG. From here, special-purpose optimization programs such as PNGOUT and OptiPNG can be used to further reduce the file size by 8% to 24,623 bytes. The same image was compressed with JPEG and JPEG2000 to approximately 27600 bytes, a larger size than PNG, resulting in the typical text compression artifacts. The results indicate that JPEG2000 is better than baseline JPEG, but both are much inferior to lossless compression. Note that converting JPEG images into PNG will not help, as these images have already been corrupted with noise that a lossless compressor will retain.

JPEG2000
0.72 bits/pixel

16-level grayscale PNG
0.64 bits/pixel

JPEG
0.72 bits/pixel

 

Blurring artifacts:

Blurring means that the image is smoother than originally. The pictures were stored at approximately 2.0 bits per pixel, four times weaker compression rate as above. Note that JPEG2000 has many problems with such artifacts. Although the shape information is correctly retained, the texture is lost. In such cases, JPEG2000 does not function well - it is perhaps worse than JPEG. People are quite good at spotting smoothness in the image.

JPEG2000
2.0 bits/pixel
1:12 compression ratio

Original

JPEG
2.0 bits/pixel
1:12 compression ratio

 

Conclusion:

Although JPEG2000 does solve a few of JPEG's problems at lower bit rates (2.0 bits/pixel), such as completely eliminating the blocking artifacts, it introduces quite prominent blurring and ringing artifacts. JPEG2000 is more appropriate for images that do not include noisy textures. At higher bit rates (3.0 bits/pixel), there are no visible differences between JPEG and JPEG2000, at rates around 2.5 bits/pixel you can find some improvement in JPEG2000 as the blurring artifacts are a bit less salient than JPEG's ringing and blocking ones:

JPEG2000
2.5 bits/pixel
1:9.6 compression ratio

Original

JPEG
2.5 bits/pixel
1:9.6 compression ratio

 

JPEG2000's lossless mode and the tiled mode are attempts to provide an unified solution. The lossless mode attempts to obviate formats such as PNG, JPEG-LS, GIF and others - but with a large computational overhead and no mentionable improvement in compression results. The tiled mode supplants TIFF as a tiled storage format enabling random access to image portions, but again with a large overhead.

JPEG2000 introduces several new features, such as region-of-interest coding, but they are not universally useful. Its progressive mode appears to be nice, though. Features for error resilience are rarely useful with reliable digital communications.

Note that in reality the pictures are not examined zoomed, as we have been doing in this article, so the compression rates can be higher than we recommend. Still, in general it is not known neither at what resolution will the image be viewed nor is known the distance of the viewer from the display.

Disclaimer:

The images above were stored in the lossless PNG format. They are enlarged within the browser for the artifacts to become better visible. I used JASC's Paint Shop Pro 7.0 for compression into JPEG, and David Taubman's Kakadu codec for JPEG2000. I was using a larger image for compression, and clipped portions where the artifacts are easily discerned. This article should be taken as an illustrated guide to artifacts, not a systematic study. I have not used detailed terminology as it wouldn't be understood by general audience that this article is targeted at.