It doesn't carry a health warning, but it really ought to. So how did the JPEG (Joint Picture Experts Group) file format, with its huge image-editing drawbacks, attain such widespread popularity?
The truth is that the JPEG has become a standard for the simple reason that you can adjust the level of compression applied either at source - tweaking the quality settings on your digital camera - or when you save the image in your editor. This is almost unique for any graphics format and is ideal for Web site pics or e-mail attachments. The holy grail of tiny file size is offered as long as you're prepared to accept a reduction in file quality.
But while JPEGs are fine for viewing and transmitting images, they're a disaster for editing. The powerful image compression algorithms may shrink files, but they also chuck away vast tracts of information every time you edit a document and save it as a JPEG.
Pause for thought
That's worrying, because most people edit an image far more than they think. Even simple actions, such as rotating or cropping then saving, can remove information. This is rarely conveyed to the user, who happily over-edits until the result is a pixelated apology for the original.
At last, this month, a tiny beacon of hope appeared. Among the functions to reduce image "noise" in Adobe Photoshop Elements 4.0 is a specific tool to help remove JPEG artefacts, those blocky imperfections and "halo" rings that appear in pictures that have been too heavily compressed. Perhaps too late to avoid the damage, but at least an acknowledgement of the problem.
Here's my real beef with JPEGs. Even if you save an image at the highest setting (which is never consistent between applications), it still degrades every time you edit the file and re-save it. This deterioration might be imperceptible to the naked eye at first, but after a few editing sessions, degradation adds up. In most image editors, even if you only adjust a tiny part of the image (for example, to apply a red-eye filter), JPEG compression is applied to every single pixel when you save it.
Why is the format so vicious? Simply because of the way it works. When you save in this format, the image is divided into independently encoded blocks, 8x8 pixels square, called macroblocks - see Figure 1. It performs compression algorithms on these, discarding values based on visual perception. The problem is that if you adjust an image, you adjust the arrangement of those blocks, so the calculation has to be repeated. The results will be different, and more information lost.
And it isn't only huge image adjustments that shift these blocks. Something as simple as cropping can move the block boundaries, which mucks up the way they are read. Only if you're careful to crop from the top or left of the image in multiples of the block size (for example, 16 pixels from the top left of the image) will the document remain unscathed.
There are some other tricks to ensure that as little detail as possible is lost. In my experience, repeated saves don't affect file quality too much if you use exactly the same JPEG compression settings each time. Equally, some operations such as 90-degree rotations won't degrade the image, with the caveat that the image's dimensions must be a multiple of the file's block size (that is, eight or 16). In most untouched images, that's the case. But note that not every image-editing application supports lossless rotation - you can see a list of those that do at http://jpegclub.org/losslessapps.html. You'll notice a few big names missing.