banner
Previous Page
PCLinuxOS Magazine
PCLinuxOS
Article List
Disclaimer
Next Page

JPEG Just Got Some REAL Competition


by Paul Arnote (parnote)

The JPEG group (Joint Photographic Experts Group) was originally formed in 1986, and it was charged with creating a "standard" for digital still picture coding. The first formal JPEG standard was approved in September 1992. Yes, almost 23 years ago.

Over those two-plus decades, the JPEG file format has become universally accepted in the digital graphics world. You can scarcely visit any website that doesn't have some JPEG graphics files on its page. The JPEG file format has become the defacto standard for the storage of graphics files on digital cameras. There are a lot of positive aspects to the use of the JPEG file format.

But as with everything, there are aspects of the JPEG format that aren't so good. Sure, using its lossy compression algorithm, it can compress images 10:1, making the images 1/10th of the size of their uncompressed counterparts. But it is within that ability that the JPEG file format falters. If you compress it too much, or if you resave the image over and over again using the same compression settings, too much of the image information is discarded. This results in a loss of detail in the image, and can result in pixelation and bad color reproduction. Sure, you can circumvent this image degradation by first saving a first generation JPEG file as a PNG file (which uses lossless compression, and doesn't discard any of the image information), performing your edits, and then re-saving the PNG file as a JPEG file again. While not a huge deal breaker, it illustrates the problems inherent with the JPEG file format.

Despite preserving 100% of the image quality, the PNG file format never really emerged as a strong threat to the JPEG file format's dominance. Without a doubt, it has managed to carve out its niche in the digital graphics world, and most web browsers support the display of PNG graphics. But it never really gained the momentum to unseat JPEG files from the "throne." This is because of the JPEG file format's ability to produce much smaller file sizes, and in a world where speed counts when visitors access a website, the smaller JPEG files download much faster than the larger, but albeit higher quality, PNG files.

Now, fast forward nearly 23 years, and finally there is a bona fide competitor to the JPEG file format. Unless you run in certain small circles, you most likely have never heard of Fabrice Bellard. For those who are unfamiliar with him (and I suspect that's the vast majority of people reading this article), Bellard is the genius behind the immensely successful FFMPEG multimedia library, and the genius behind the QEMU virtualization hypervisor. He has now lent his talents to creating a better graphics format with compression as good as or better than the stalwart JPEG file format.



JPG on the left, BPG on the right, with similar levels of compression and similar file sizes. Notice the pixelation of the image background on the JPG side, and the total lack of pixelation on the BPG side. Also take note of the increased clarity and detail on the BPG side of the image.

Bellard's new format is called BPG, which is short for Better Portable Graphics. While the older JPEG format uses 8 bits per channel, Bellard's new BPG format uses 14 bits per channel, and even supports transparency and alpha channels. As a result of the higher bit count per channel, Bellard is able to achieve the same level of compression as the JPEG file format, but without the significant image detail loss that besieges the JPEG format. Additionally, there is an option in the BPG format for lossless compression, similar to how the PNG format works.

Bellard's BPG format is based on a subset of the HEVC (High Efficiency Video Coding), the slated successor to the H.264/MPEG-4 AVC format currently used by Blu-Ray discs. Besides supporting all of the same chroma formats as the JPEG format, it also supports RGB, YCgCo and CMYK color spaces.

Here are some other examples comparing MozJPEG to BPG. JPEG is on the left side of the divider, BPG is on the right side of the divider. Both formats are set to display images of a small file size, which translates into higher levels of compression.













Don't expect to see much of BPG around, at least here at first. There are a few reasons. First, BPG is so new that there are little to no software titles that support it. Bellard hopes that browser and graphics application developers will include support for it in the future. Bellard has written an open source encoder and decoder for Linux and Windows, along with a small JavaScript decoder that can be used in most modern day browsers. Bellard is also hopeful that the HEVC support that is being included into some chipsets will allow for hardware decoding of the BPG images, allowing software vendors to skirt around any licensing issues.

Second, there are the licensing issues themselves. HEVC is controlled by MPEG LA, the patent consortium of content providers -- 23 companies in the case of HEVC -- who will undoubtedly be pursuing royalties from any vendor who includes HEVC support. Since MPEG LA holds the licensing reins for HEVC, it is demanding a $0.20 royalty per HEVC product after the first 100,000 units, per year, with an annual cap. This is the reason that hardware decoding becomes so attractive. Instead of each graphics application developer and each browser developer having to pay royalties, the royalties would (conceivably) be paid only when a graphics card with HEVC support is purchased. Of course, the royalties would be embedded into the price that the end user pays for the graphics card, and the end user would be none the wiser.


Not The Only Competitor

There are other competitors working to supplant the JPEG format as the de facto go to graphics format. Google has its WebP format, which is based on the VP8 video compression codec Google inherited when it purchased On2 Technologies in February 2010. WebP is a subset of Google's WebM multimedia codec, and is released under a BSD license.

WebP supports both lossy and lossless compression. Google claims that WebP images are 40% smaller than the same file stored in the PNG format, and 28% smaller than a PNG that has been optimized with pngcrush and pngout. Since WebP also supports animation, Google claims a 64% reduction in file size using lossy compression over the same animated GIF, and a 19% reduction in file size when using lossless compression.



WebP (left side of the divider) comes closest to matching the quality of BPG files (right side of the divider), but there is still a noticeable difference. BPG files still come out on top with superior quality.

Google Chrome and Opera already have native support for the display of WebP graphic files, as do most other browsers based on WebKit. On Linux, ImageMagick and XnView have native support among graphics programs. GIMP supports WebP via a plugin. As you can imagine, nearly every Google service (Gmail, Google+, Picasa, Google Image Search, etc.) supports the use of the WebP format.

Meanwhile, over in the Mozilla camp, they have abandoned trying to support WebP. Instead, they have sunk their efforts into producing a superior JPEG encoding library, called MozJPEG. Originally released in March 2014, a much improved MozJPEG 2.0 library was released in July 2014. The original version shaved 10% off of file sizes, and version 2.0 cut file sizes by another five percent. Mozilla achieves its results by utilizing trellis quantization, which improves compression for baseline and progressive JPEGs, without sacrificing compatibility. Originally, version 1.0 of the MozJPEG library only worked on JPEG files that were progressively encoded. Facebook has contributed $60,000 (U.S.) towards the development of MozJPEG.


Summary: Explore The Differences Yourself

Overall, BPG outperforms any of the other graphics formats, which is what makes it newsworthy. But you don't have to take my word for it. You can go take a look yourself. Point your browser over to the BPG sample page, and you can directly compare files encoded with MozJPEG, WebP, JPEG2K, BPG and the original image. Moving your cursor over the picture moves a reference line across the image. On one side of the reference line is one graphic format, and another graphic format is on the other side. This allows you to make direct comparisons between the formats.

Let's all hope that a way can be found around the licensing obstacles that are bound to crop up. Sad though it might be, the greed of the MPEG LA members may succeed in hindering its widespread adoption, at least until those applicable patents expire. Still, it's nice to know that something exists on the horizon to give us much improved rendering of our digital images.



Previous Page              Top              Next Page