Earthbound Light - Nature Photography from the Pacific Northwest and beyond by Bob Johnson
Online Ordering
Recent Updates

Photo Tip of the Week

JPEG: The Good, the Bad and the Ugly

The JPEG image format is the most common file format used for digital images, hands down. The term "JPEG" has become almost synonymous with "image" in common usage. But in actual usage, JPEG works great for some things, but really isn't your best choice for other uses.

Once Upon a Time
Interestingly, JPEG refers to the "Joint Photographic Experts Group," the organization that developed the image file format beginning back in 1992. The format itself is more correctly referred to as "JPEG File Interchange Format," or JFIF. But that hasn't stopped people from adopting the JPEG term more broadly.

Early image files stored every bit completely uncompressed and were simple but huge. These were followed by simple compression schemes known as "Run Length Encoding" or RLE that replaced consecutive sequences of the same value with a single occurrence together with a numeric repetition factor. Thus, a hundred white pixels could be stored simply as "100 x white" and so on. In 1987 CompuServe introduced the GIF (or "Graphics Interchange Format") format used a more sophisticated compression schema and added support for color (early RLE schemes where black and white only). GIF was the first real image format used in the early days of the World Wide Web. By 1994 though, the collective Web began to freak out when CompuServe and Unisys (originator of the compression used in GIF) declared that there was a patent on all this and that they expected everyone to pay licensing fees to Unisys to continue using GIF.

Clearly this provided a huge motivation for the Web to accelerate the adoption of JPEG as the image format of choice. The patent in question expired in 2003 but not before subjecting CompuServe and Unisys to derision by pretty much everyone except CompuServe and Unisys. Today, CompuServe has faded into history and the GIF format has been mostly relegated to use for animated images of small, cute cats and similar subjects. Today, JPEG rules the Web.

The Good
One of the primary strengths of the JPG format is its ubiquity. Almost every application and device that works with images knows how to work with JPEG images. And why not? JPEG images can do a great job of rendering images over a broad range of contexts. You can create a JPEG as large as several gigapixels which is much larger than cameras can capture, printers can print, or the human eye can discriminate at normal viewing distances. You can embed ICC color profiles in JPEG images to allow for accurate specification of color and gamut. You can embed EXIF and similar metadata tags in them to keep track of shooting data and other information related to your images.

The JPEG format is cross-platform and works just as well on Windows PC's as it does on OS X Macintosh computers. Linux, Android, and every other platform can read the same JPEG files too. They have to be able to, or else nobody would use those platforms. JPEG is that important and its usage that widespread.

The modest size of JPEG files permits cameras to offload more of them in a given amount of time than is possible when shooting larger RAW format images. This lets you keep firing away without having to wait on your camera to catch up. You can fit more of them on a given sized memory card too, and more or them on your computer's hard drive too.

Because everything can understand JPEG images, you can see them right away without the need for further processing, and you can email them to your friends or post them online straight from the camera too, although the resolution of current camera models is beginning to make that somewhat unwise simply due to typical monitor sizes and capabilities.

Since JPEG has been a stable image format for quite a few years now, nobody worries about them not being usable in the future.

Indeed, there's a lot to be said in favor of the JPEG format. Its popularity is not without just cause. So long as you are happy with how your images look straight out of your camera, you could be quite happy with nothing but JPEG.

But there are limits.

The Bad
One of the reasons that JPEG images are so easy to render is that they're comparatively simple in concept. Apart from the mathematical wizardry of the underlying compression mechanism that was the subject of the patent dispute already mentioned, a JPEG file is pretty straightforward. What you see is what you get. The uncompressed data is already in a format compatible with what we can see. The inherent gamma curve defining the transition from dark to bright is already baked into the JPEG format.

JPEG can't do everything. While it can accurately render pretty much whatever you need, it doesn't contain enough information to allow more than modest tonal corrections without showing wear and tear. JPEG images contain just 8 bits per color channel. With a color channel each for red, green and blue, this yields only 16 million discreet possible hues and shades across the entire spectrum and from black to pure white. That's more than the human eye can discern, but if you start trying to correct exposure or remove a color cast you end up spreading just a few recorded values over wide output range resulting in gradients that no longer look completely smooth and continuous toned.

The Ugly
Perhaps the biggest limitation inherent in the JPEG format is the fact that the compression used is lossy. That is, you lose some information in the process of compressing it. Of course they didn't design this thing to lose critical information to the extent they could avoid it. While the compression ratio can be overdone, typical ratios in actual usage situations preserve enough detail to make them generally indistinguishable from uncompressed images.

But if you edit a JPEG and re-save it, it gets compressed all over again, and loses just a bit more information in the process. Indeed, every time you do this, you lose more and more. With each iteration, the change is generally imperceptible from the previous version, but if you compare the final product to the original version, you may be surprised at how much has been lost. Editing JPEG files is inherently problematic for this reason. Do it just a little and you'll never see the problem. Do it habitually and you'll be risking the very images you're investing your time in editing.

JPEG works great for displaying images but is a poor choice for editing. If you degrade your image in the act of attempting to improve it, whatever space saving and simplicity that JPEG provides simply isn't worth it when better options exist. If you decide to capture images in JPEG, make sure you edit them with a nondestructive editor such as Lightroom or else save them in a non-compressed format such as Photoshop PSD or TIFF. Hard drives today can accommodates tons of images without having to resort to compression.

Mt. Rainier after being subjected to repeated JPEG compression
Mt. Rainier after being subjected to repeated JPEG compression

For a Few Dollars More (with apologies to Sergio Leone)
As long as we're on the topic of JPEG image format popularity and the consequences thereof, it's probably worth taking time to discuss the PNG format. Back when CompuServe and Unisys where trying to make everyone pay up, some folks were searching for alternatives to the then-popular GIF format. Officially, PNG (pronounced commonly as "ping") stands for "Portable Network Graphics" but the in joke among its creators back in 1995 was that "PING" stood for "PING Is Not GIF," no doubt to express their feelings as a subtext embedded in the name. Rather than pay up for using GIF, they designed a better format that everyone could use without cost.

The creators of PNG learned from what people liked about both GIF and JPEG. Except on very small images, Indexed color PNG images will be smaller than their GIF counterparts and provides better support for transparency (alpha channel). In contrast to the JPEG standard, PNG compression is lossless. While this will result in larger file sizes than equivalent JPEG images, it ensures that image quality isn't compromised when files are saved. PNG also supports 16-bit color to provide enough detail for editing without banding and other artifacts possible with 8-bit images.

So is PNG a viable replacement for RAW formats? Nope, even PNG can't do that. The value of RAW comes from the fact that it preserves the data as captured by your camera's sensor, hence the name "raw." By retaining this data as captured it ensures you have the greatest latitude to correct any issues caused by the way cameras see the world as opposed to the human eye and brain. Non-destructive RAW editing may need specialized software not required for other image formats, but if you care about your images and want to make sure you have the best chance possible of preserving quality, RAW is worth it.

But PNG can be a great alternative for JPEG and certainly for GIF. No, cameras don't capture PNG images, at least not yet. But web browsers and many other applications are quite happy with them, and if history tells us nothing else, it tells us that technology can and does change.

Date posted: October 19, 2014 (updated October 20, 2014)


Copyright © 2014 Bob Johnson, Earthbound Light - all rights reserved.
Permanent link for this article

Previous tip: Auto White Balance Versus the Sunset Return to archives menu Next tip: More on the Subject of Blinkies

Related articles:
The Ever-worsening JPEG Phenomenon
More Than a Bit of a Difference: 8-bit Versus 16-bit
Just What is a RAW File Anyway?

Tweet this page       Bookmark and Share       Subscribe on Facebook via NetworkedBlogs       Printer Friendly Version

Machine translation:   Español   |   Deutsch   |   Français   |   Italiano   |   Português

A new photo tip is posted each Sunday, so please check back regularly.

Support Earthbound Light by buying from B&H Photo
  Buy a good book
Click here for book recommendations
Support Earthbound Light
  Or say thanks the easy way with PayPal if you prefer

Home  |  About  |  Portfolio  |  WebStore  |  PhotoTips  |  Contact  |  Comments  |  Updates  |  Support
Nature Photography from the Pacific Northwest and beyond by Bob Johnson

View Cart  |  Store Policies  |  Terms of Use  |  Your Privacy