In the January, 2013 issue of Shutterbug, which arrived at my house last week, David Brooks has his usual column, “Q&A Digital Photography”. A reader asks a question about an earlier column (that I didn’t notice) that said the JPEG 2000 used lossless compression.
Mr. Brooks gives the following answer:
The file formats supported by most applications used for digital photography are of two basic types: 1) lossy compression versions like JPEG, that became popular many years ago because they result in small file sizes, but this is no longer an important advantage because file storage space is now very inexpensive; 2) lossless formats like TIFF, PSD and JPEG 2000 among others that do not throw out data to obtain a small file size. So, if you want to preserve the data in an image file, do not resave in JPEG or any lossy file format.
Mr. Brooks is correct when he says that some file formats employ lossy compression and some employ lossless compression. He is incorrect by virtue of a technicality in his assignment of the original JPEG to the lossy category. That’s not sufficient reason for me to write a post on the subject. Brooks is also wrong when he says that JPEG 2000 is unequivocally lossless, and his advice to photographers to save and resave their files in JPEG 2000 to prevent loss of information may cause some people to use JPEG 2000 inappropriately.
First, the technicality. The original JPEG supports both lossy and lossless compression. The lossy compression is based on applying the discrete cosine transform (DCT) to eight pixel by eight pixel blocks of the image. The lossless compression uses differential pulse code modulation. The reason that it’s a technicality is that none of the photographic image processing programs use the lossless compression algorithm exclusively, because the amount of file space it saves is small – usually less than 50%. So, from the point of view of most photographers, JPEG is lossy.
Moving on to JPEG 2000, a similar statement applies: JPEG 2000 supports both lossy and lossless compression through two different forms of wavelet compression. However, it’s not a technicality, since some image processing programs, notably Photoshop, support both modes. The default in Photoshop is lossy compression, but you can select lossless by clicking a checkbox:
In order to prove that JPEG 2000 without the lossless box checked is lossy, I brought this image in to Photoshop:
Here’s the histogram:
I saved it as JPEG 2000 with the lossless box unchecked, and read it back into Photoshop. Here’s the histogram:
And, just to make it more explicit, here’s the histogram of the difference between the two images:
Stored as an uncompressed TIFF, the original file was 1732KB. Saved as lossless JPEG 2000, it was 1518 KB.
Here’s the bottom line. As a lossy file format, JPEG 2000 offers somewhat better image quality at the same file size, or somewhat smaller file size at the same image quality as the original JPEG. As a lossless file format, it offers somewhat smaller file sizes than uncompressed formats. If you want to use it as a lossless format, you need to make sure you pick the right options.
Leave a Reply