Beyond JPEG

It's surprising that the venerable JPEG image compression standard, which dates back to 1986, is still the best we can do for photographic image compression. I can't remember when I encountered my first JPEG image, but JPEG didn't appear to enter practical use until the early 90's.

There's nothing wrong with JPEG. It's a perfectly serviceable image compression format. But there are newer, more modern choices these days. There's even a sequel of sorts to JPEG known as JPEG 2000. It's the logical heir to the JPEG throne.

The promise of JPEG 2000 is higher image quality in much smaller file sizes, at the minor cost of additional CPU time. And since we always seem to have a lot more CPU time than bandwidth, this is a perfect tradeoff. You may remember my comparsion of JPEG compression levels entry from last year. Let's see what happens when we take the two worst-looking images from that comparison – the ones with JPEG compression factor 40 and 50 – and use JPEG 2000 to produce images of (nearly) the exact same size:

JPEG, ~8,200 bytes JPEG 2000, ~8,200 bytes
JPEG Lena image, filesize ~8,200 bytes, compression factor 50 JPEG 2000 Lena image, filesize ~8,200 bytes
JPEG, ~10,700 bytes JPEG 2000, ~10,700 bytes
JPEG Lena image, filesize ~10,700 bytes, compression factor 50 JPEG 2000 Lena image, filesize ~10,700 bytes

No current web browsers can render JPEG 2000 (.jp2) images, so what you're seeing are extremely high quality JPEG versions of the JPEG 2000 images. Click on the images to download the actual JPEG 2000 files; most modern photo editing software can view them natively.

JPEG 2000 not only compresses more efficiently, it also does a better job of hiding its compression artifacts, too. It takes a lot more bits per pixel to create a JPEG image that looks as good as a JPEG 2000 image. But if you're willing to pump up the file size, you aren't losing any fidelity by presenting JPEG images.

Microsoft, as Microsoft is wont to do, offers a closed-source alternative to JPEG 2000 known as HD Photo or Windows Media Photo. As of late 2006, Microsoft made the format 100% royalty free, and support for HD Photo is included in Windows Vista and .NET Framework 3.0. According to this Russian study, Files in Microsoft's HD Photo format (.hdp, .wdp) are comparable to-- but not better than-- JPEG 2000. The study PDF has lots of comparison images, so you can decide for yourself.

Unfortunately, it doesn't really matter which next-generation image compression format is better, since nobody uses them. Microsoft neglected to include support for HD Photo in Internet Explorer 7. And Firefox doesn't currently support JPEG 2000, either. It's a bit of a mystery, because there's an seven year-old open bug on JPEG 2000, and the OpenJPEG library seems like a logical fit.

Until a commonly used web browser supports JPEG 2000 or HD Photo, there's no traction. I hope the next browser releases can move us beyond the ancient JPEG image compression format.

Read more

Stay Gold, America

We are at an unprecedented point in American history, and I'm concerned we may lose sight of the American Dream.

By Jeff Atwood · · Comments

The Great Filter Comes For Us All

With a 13 billion year head start on evolution, why haven't any other forms of life in the universe contacted us by now? (Arrival is a fantastic movie. Watch it, but don't stop there - read the Story of Your Life novella it was based on

By Jeff Atwood · · Comments

I Fight For The Users

If you haven't been able to keep up with my blistering pace of one blog post per year, I don't blame you. There's a lot going on right now. It's a busy time. But let's pause and take a moment

By Jeff Atwood · · Comments

The 2030 Self-Driving Car Bet

It's my honor to announce that John Carmack and I have initiated a friendly bet of $10,000* to the 501(c)(3) charity of the winner’s choice: By January 1st, 2030, completely autonomous self-driving cars meeting SAE J3016 level 5 will be commercially available for passenger

By Jeff Atwood · · Comments