Like HowStuffWorks on Facebook!

Why are my digital photograph files so huge while photos on other Web sites are much smaller?

        Tech | Graphics & Video

JPEG format, 400x336 pixels, 20% compression, 37 kilobytes
JPEG format, 400x336 pixels, 20% compression, 37 kilobytes

If you are designing a Web site, sending digital photographs as e-mail attachments or trying to pack as many images on a floppy disk as possible, the size of each image is important. What you want to do is shrink the file size to as few bytes as possible without hurting the image quality.

Most Web sites that publish photographs use the JPEG (pronounced "jay-peg") format for their images. JPEG is a popular format for two reasons:

  1. It has good compression characteristics on photographic data.
  2. It lets you adjust the amount of compression.

Sites like BBCi and CNN.com adjust the compression ratio to shrink the file size. Most image-handling programs let you tweak the JPEG compression ratio in one way or another. For example, Paint Shop Pro lets you adjust the compression ratio on a scale from 1 to 99, with 1 offering the best image quality and lowest compression ratio and 99 offering the lowest quality and highest compression.

The following images give you some sense of the effect that different compression ratios can have on image quality. In all cases, I started with the same 400x336-pixel image. The original JPEG image at 1-percent compression (maximum quality) takes up 152 kilobytes of disk space, so it is not even included. Besides, there is no difference between 1-percent compression and 20-percent compression in terms of image quality, even though the size of the file goes down by a factor of four!

JPEG format, 400x336 pixels, 40% compression, 25 kilobytes
JPEG format, 400x336 pixels, 40% compression, 25 kilobytes
JPEG format, 400x336 pixels, 60% compression, 19 kilobytes
JPEG format, 400x336 pixels, 60% compression, 19 kilobytes
JPEG format, 400x336 pixels, 80% compression, 12 kilobytes
JPEG format, 400x336 pixels, 80% compression, 12 kilobytes
JPEG format, 400x336 pixels, 90% compression, 7 kilobytes
JPEG format, 400x336 pixels, 90% compression, 7 kilobytes
JPEG format, 400x336 pixels, 95% compression, 4 kilobytes
JPEG format, 400x336 pixels, 95% compression, 4 kilobytes

When I look at this particular image, I can begin to see minor degradation at 60-percent compression (most visible on the border of the blue shirt). Eighty-percent and 90-percent compression is progressively worse, and 95-percent compression is badly pixelated. Forty- or 50-percent compression is probably a good value for this image, with an image size of 20 to 25 kilobytes.

Another way to lower the size of the file is to reduce the image size. For example, here's the same image in a 200x168 format:

JPEG format, 200x168 pixels, 40% compression, 12 kilobytes
JPEG format, 200x168 pixels, 40% compression, 12 kilobytes
JPEG format, 200x168 pixels, 60% compression, 9 kilobytes
JPEG format, 200x168 pixels, 60% compression, 9 kilobytes

This smaller image size reduces the file size by a factor of two!

If your scanner is creating 100-kilobyte files, then your scanner is probably producing images in an uncompressed or slightly compressed JPEG format. Using a program like Paint Shop Pro, you can open the image and re-save it at a different compression ratio to shrink the file size significantly.

These links will help you learn more: