Today we’ll learn about the JPEG format — where it excels, where it falls short, and when you want to use it.
JPEG is a way of making that image file smaller, which we learned is often a good thing. However, part of the way that JPEG makes the file smaller is by losing some of the sharper transitions of color or intensity. This is called “lossy compression”, which simply means that in the process of making the file smaller some information about the image is lost. The size savings can be pretty significant — that 10 MB “raw” file on my camera is about 5 MB when saved as a high quality JPEG, and goes down to less than 100 kB (about 1% of the raw file size) when I tweak a couple of settings.
When to throw away pixels and color information
When I take that 10 MB raw file and save it as a 100 kB file to send in an email, I’m losing a lot of information. However, if the person who gets the photo is just looking at it on their computer screen, they will probably never notice. This is because of pixels per inch and color depth.
One of the tweaks I made to the file when I made it smaller was to change the file from the (approximately) 3000 pixels by 2000 pixels that my camera stores to 600 pixels by 400 pixels. With that setting, the photo software takes its best guess as to what will make the picture look about the same, and throws away the rest. This is actually a good thing, because the recipient’s computer monitor probably displays 72 pixels per inch. If they tried to display the original picture at full size, they would have an image over 40″ across, which isn’t very convenient. Their email program would probably shrink the image down, losing the pixel information anyway, and it won’t make as good of a guess about image quality as my photo software will.
Color depth is another reason why we can lose information and not have it matter for the monitor. If you have an average monitor, your computer can show about 16 million different colors. Each different color can be represented inside your computer with 24 bits (a bit is a 1 or a 0). That’s a lot of colors, and is plenty for looking at my cute puppy photo on the monitor. But my camera stores about 4 trillion different colors, which needs 42 bits — almost twice as many 1’s and 0’s as the monitor uses. If we’re willing to give up the colors your monitor can’t display, we can save half the file size.
When do you want to keep the extra pixels and color information?
If I’m printing the picture of my cute puppy, I want every one of those pixels. Even fairly old cheap printers can handle 300 dpi (dots per inch — like a pixel on your monitor), which means if I want an 8×10 puppy print, I need all 3000 x 2000 pixels in the original. Many printers can handle even more dpi, so even a wallet-sized photo can use all the pixels. This is why when you upload a photo to a photo-printing website they may tell you that you can’t print the larger sizes they have available — they know that you don’t have enough pixels for the picture to look good at those large sizes.
When do you want to keep the colors your monitor can’t display? If you are going to be playing with the image, say to bring out the contrast in the shadows or fix skin tones, you will get the best results if you start with the most color information. Remember, you can always save to a smaller file size after you are done.
When to use JPEG
JPEG is the workhorse of picture formats. Most of the photos you get in emails are JPEGs, as are most of the photos you see on websites. If it’s a photo and you don’t have a really strong reason to use another format, JPEG is usually a good choice.