So, Why Does JPEG Suck?

December 16, 2016  •  Leave a Comment

In a recent article I briefly mentioned (well, it was also alluded to in the title of that article) that JPEG sucks. I showed an example but didn't further elaborate. Today I'll elaborate.

The Basics
The JPEG file format was developed by an ISO working group to facilitate transmission of photographic images across the internet by reducing the size of the files. (You can read waaay more than you care to about its history and technical details on Wikipedia.) It rose to popularity because it does what was intended: reduce the amount of data required to store an image that looks like the image and, thus, computers can move that data from place to place more quickly.

The phrase in the middle of that paragraph, "…an image that looks like the image…" is the key to how it works its magic, and why it sucks.

The Magic
Here is a two-by-two grid of green blocks and orange-y blocks. Let's assume these blocks represent single picture elements (pixels) and your computer monitor displays 100 pixels per inch, so these four blocks will occupy a mere 1/50" square on your screen. That's a tiny speck and you won't notice if, instead of two green and two orange-y pixels (middle box, below), it's just a single four-pixel greenish speck (right box).

That's the magic of JPEG — it substitutes larger groups of pixels of a single color to replicate how our eyes perceived that same area; how our eyes melded those disparate pixels, too tiny to resolve individually, into a single hue. Nice! And by substituting these larger, melded-color, super-pixels for the individual pixels of the original, it takes fewer computer bits to store and transmit the image. Right here, with no other JPEG shenanigans, we've reduced the file size by 75%! What's not to like?

The Suck
The problems with JPEG fall into three main areas: loss of detail, loss of color fidelity, and the permanence of those losses.

On average a JPEG looks fine when viewed on a computer screen if you don't zoom in on it. If you do zoom in, you'll likely see the super-pixels and a commensurate loss of detail due to those super-pixels having replaced the greater number — and thus greater resolving power — of regular pixels.

Here's a four-by-four grid of blended colors, then that grid reduced to 10% as a JPEG, then enlarged to show what happened when it was attacked by, um, converted to JPEG.

It looked fine when it was small, but note all the stripes and blocks of colors that were the result of making the file size smaller. If you are never going to need that little file to be viewed or printed or projected larger than it was, everything will probably be okay. But as the enlarged version shows, if you (or people you hand the JPEG to) have to enlarge it for a brochure or a poster or a trade show graphic, those artifacts are unsightly — and permanent. Here's a close-up.

Further, if you open a JPEG in a program such as PhotoshopElementsLightroomGIMPPaintShop ProPaint or others and make changes then save it again as a JPEG, the algorithm will re-jigger the pixels/super-pixels to again "optimize" the file size. The result? Further degradation. Ugh!

And I won't get into pixels-per-inch any more than to note that printing an image in a brochure or poster requires three times the pixels-per-inch as viewing that image on screen. As a test, if you want to see how your favorite little JPEG will look in your next product card, zoom to 300% on your monitor and see how it fares. Great? Meh? Horrible?

What to Do
If you have a JPEG image that you like and plan on using in the future, if possible open it with an image editing app (see above for a few) and save the file in a format that doesn't add artifacting, such as TIFF or PSD. Use that file as your master for creating copies, even JPEGs, in the future. Converting to a TIFF or PSD does not erase the artifacts that were already present, but at least you won't be adding new ones.

In the imaging editing app, you should find that there are settings that affect how much the file size is reduced when saving a JPEG. Just understand that the smaller you make the file, the higher the incidence and obtrusiveness of the artifacts. At the highest quality settings, the file size may not be significantly reduced but the details and colors will remain closer to the original.

It's this adjustability that leads to JPEG being the go-to format for transmitting even very high quality images by vendors. So don't be surprised if you receive a JPEG from a photographer or stock photo house, but do save it to TIFF or PSD once you receive it and, again, use that as your master.

As an analogy, consider TIFF and PSD files to be your recipes and JPEGs to be the finished dish. (Well, it's not a great analogy, since you can't be served a dish at a restaurant and then turn it back into ingredients, but work with me!) The point is, use JPEG only as a final file format for transmitting over the internet (email, too). The graphics people, in-house or vended or magazine, will thank you.

I never use JPEG files, except for when I do. Then I create them at the end of the process with quality settings that are optimized for the downstream tasks, always retaining the non-artifacting master files.

I was looking more closely at the green-and-orange-y art, above, and realized that when I created the graphic — as a JPEG for this article, admittedly — not only did the JPEG process average out the two colors, it added a constellation of lightly colored pixels to the left of the four-by-four greenish pixels. The following is a close-up of the center of that post-post-JPEG graphic. In the left half you see the blended-greenish center pixels and, faintly, pixels that were added during the conversion. To highlight them, I darkened and exaggerated their colors, shown at right.

Admittedly these stray pixels are difficult to see, against the white field, but a graphic artist, using a JPEG as a starting point, might easily run into difficulties in modifying the image if additional chrominance, reduced luminance, or increased contrast figure into their adjustments. I'm telling you, JPEG sucks!


No comments posted.
Photography is a massive field. Aerospace photography less so. In these writings I share stories and tips.
January February March April May June (2) July (2) August (1) September October (2) November December (1)
January February March (2) April May June July August September (6) October (15) November (2) December (2)
January (2) February (2) March (2) April (2) May (2) June (2) July August September October November December