Thursday, January 7, 2010

JPEG Image Compression

Have you been heard a lot of confusing stuff about JPEGs image file? Some people said they are perfect for online photography, and other people said that converting images to JPEG will throw away most of the quality of the picture. I don't want to ruin my pictures, so should I be using JPEG?

There is a grain of truth in both sides of this question. The bad news is, JPEG compression does throw out information in your picture. The good news is, most of the time, you're not going to be able to tell the difference.

JPEG compression works under the assumption that if two areas are almost exactly the same color, the average viewer is going to see them as the same color. If the entire area can be saved as one color, that's a lot less data to be stored in the file, and the compressed version becomes a lot smaller. Smaller images are important for both emailing and loading web sites.

As an example, JPEG compression might take a black shadow thrown against a very dark grey background, and remove the shadow, so that the entire area is roughly the same color. This is over-simplifying, of course. The end result is that fewer individual colors translate to a much smaller file.

The danger with JPEG is when a picture is compressed multiple times. One of the worst things you can do to a picture is to save it as JPEG three or four times in a row, because each save will compound the quality lost. Just like a fax that gets forwarded or a photocopy of a photocopy, the quality of the picture will suffer. After a couple of rounds through the JPEG program, it will be obvious where it decided to save space. For this reason, when you're editing your photos, always start with a lossless format (like PNG or TIFF), and don't convert your image to JPEG until the editing is done.