Quantcast
PCWorld.com is upgrading some back-end systems. Some site features, such as user registration, may be temporarily unavailable.

Blogs

    Digital Focus

  • Dave Johnson's expert tips promise to enhance your expertise with your digital camera, scanner, printer, and image editing software.
  • Subscribe to this blog

Digital Focus: Everything You Didn't Know About JPEG

Dave Johnson

Feature: Everything You Didn't Know About JPEG

Talk about a success story--the JPEG file format seemingly came out of nowhere about a decade ago, and now JPEG (with its .jpg file extension) is the single most common digital image file format on the planet. JPEG is used by most digital cameras and scanners, and it's the common language of picture sharing between friends, family, and coworkers. PCs use JPEG. Macs use JPEG. It's simply ubiquitous.

But it wasn't always this way. Before 1995, every image editor, paint program, imaging device, and operating system had its own preferred file format. I routinely juggled PCX, TIFF, TGA, GIF, and bitmap files, and I owned software designed--believe it or not--to do nothing other than translate images from one format to another!

Though JPEG is nearly universal, many people just don't know how to get the most out of the format. This week, I thought we'd dive into all the useful things you may not know about JPEG.

Lossy Giveth and Lossy Taketh Away

First and foremost, JPEG images are "lossy." In other words, digital images saved in JPEG format are compressed to save space--and compressed so that some information is lost along with some image quality. The JPEG format exploits subtle but important limitations in human vision: We have trouble accurately perceiving small changes in color between objects that are in close proximity. Consequently, the JPEG algorithm is designed to discard small amounts of color information between adjacent pixels on the assumption that we won't be able to perceive what was lost anyway.

The system works pretty well. Consider a 900-by-975-pixel image of a bee. The original version, saved in the TIFF file format, is just shy of 2MB. Saved as a JPEG, it takes up a mere 500KB, a quarter of the original size. If you could look at the TIFF along with the JPEG, would you be able to see the difference? Possibly, but you'd have to look very hard to find it.

Picking the Right Compression Level

That's good, but we can do a lot better. The picture is 500KB because I always save my JPEGs at the very highest quality level I can get--which is, not surprisingly, the lowest compression level. The great thing about the JPEG format is that you can vary the compression level to suit your needs. If saving disk space or making a small file for tasks like e-mail transmission or posting on your Web site is more important to you than image quality, use more compression. For example, I tried a compression level of 50 percent on the bee image.

If you want to compare the two versions, try loading both at once in two different browser windows and then use Alt-Tab to switch back and forth between them. The loss of quality is obvious. But guess what? The second image weighs in at a scant 22KB. In other words, it's about 1 percent the size of the original image.

If you're curious about how to find the image compression control, fear not--it's usually an option when you save an image file. Choose File, Save As in Jasc's Paint Shop Pro, for instance, and click the Options button. There's a Compression Factor slider that ranges from 1 to 99. Other programs might use a different scale, but the result is the same.

In reality, though, the 50-percent-compression picture is too compressed: It lost its photo-realism. My advice? The sweet spot in image compression is usually about 10 percent.

The 10-percent-compression bee looks pretty much the same as the first bee (try the Alt-Tab comparison to see for yourself), yet it has a file size of 150KB, about two-thirds smaller. That's not bad, so you might want to set your image editor's JPEG compression level somewhere between 1 and 10 percent for most of your work.

Your digital camera doesn't have a numerical quality setting, however. Instead, it probably just has a choice of three quality levels, usually indicated by adjectives like best, good, and normal. You should always use the best setting your camera offers, because it produces your "digital negative," and you want the highest quality you can get to begin with.

Avoid Recompressing

That said, it gets just a little more complicated when you edit your pictures. (Ever notice how everything is always just a little more complicated than you first expect?)

In a nutshell, you should avoid recompressing your image files. Suppose you take a picture and load it into your image editor. Since it started as a JPEG in your digital camera, it has already been slightly compressed (depending upon your camera's image quality setting). If you make changes to the picture and save it again as a JPEG, you're compressing it even more and discarding additional color information. If you do that frequently enough, the changes will become obvious--like the badly compressed bee image.

How can you avoid this? One method is to save your edited photos in a lossless format like TIFF. When you use the TIFF format, you "lock in" the image's current level of quality without doing any further damage. An alternative is to save your changed photo in JPEG format with the compression level set to the bare minimum; if you do that, any loss in image quality probably won't be visible to the naked eye. Just be sure you repeat the process over and over. And remember that just opening, viewing, copying, or moving JPEGs doesn't degrade them. It's only when you make changes and save again does the potential for damage occur.

  • Recommend this story?
  • 0 Yes
    0 No

Dell Fast Track

Learn more about the Windows Phone PCWorld Gift Guide

Focus on Personal Productivitysponsored by Microsoft

  • Personal Finance 2.0 These free and fee-based Web services not only aggregate data from your online bank accounts, they give you tools for managing your money.
  • High-Tech Travel Tips Plenty of stories provide advice for elite mobile professionals. But what about you, the unproductive traveler?

People who read this also read:

Digital Focus

All PC World Blogs

  • 15 Minutes to a Secure Business Get the Secure in 15 toolkit starting with the "15 Minutes Month-at-a-Glance" calendar. McAfee will send you additional tools and tricks to stay protected around the clock.
  • A Buyer's Guide to Data Protection Implementing data protection products and processes can be daunting. Make the right decisions by exploring what is available and what makes sense for your organization. Use this simple guide to evaluate different vendor offerings.

Sponsored Links