I will attempt to make a bewildering topic a bit more intelligible in this overview.
What I’m going to cover
I’ll take you through a bit of what happens inside your camera, how pixels are stored in an image file, how image files are stored on a computer, and how to choose the right resolution for different usages. I’ll be generalizing with a heavy hand to keep the explanations as simple as possible.
I will use one of my cameras (Canon 50D) as the example. It’s a standard dSLR camera, the sort with removable lenses. If you’re using a camera phone or a point-and-shoot, all the same considerations apply, but some of it is hidden from you or not accessible.
A digital image file is essentially a grid composed of discrete dots, called pixels (short for “picture elements”). When you look through your viewfinder (or at the viewscreen) on your camera, think of the scene as having a fine mesh screen superimposed on what you see. Your camera’s sensor array has one “slot” for each hole in that grid. My camera’s sensor array is a grid that is 4752 x 3168, which is 15,054,336 pixels, or 15.1 MP (mega-pixels, mega = 1,000,000). That’s why Canon refers to it as a 15 MP camera. If your camera phone is 5 MP, then its grid is more coarse, covering the same amount of image with bigger holes.
Digital images typically define a pixel’s color by referring to its red, green, and blue components. (We’ll talk about how colors are defined and combined in a later article). If I know exactly how much blue and its brightness, how much green and its brightness, and how much red and its brightness are represented in one pixel, then I know exactly what color of, say, periwinkle blue and its brightness was captured. So for each pixel, I have to know some information about each of 3 color channels. In fact, I have to know 8 bits of information about each.
Bits and bytes
A bit is a small piece of information. It can be either a one or a zero. (At the bottom level, computers are all about how to move bits around.) If I have one bit of information about a pixel, I might be able to tell if it is black or white. If I have 2 bits, I can tell more about it. It turns out (grossly simplifying…) that 8 bits is just the right amount of information for most uses to tell which of a great many possible blues and how much brightness one color channel has.
For other files on a computer, such as text files, 8 bits is also a very useful amount of information. If I have 8 bits of information, I can designate a particular letter of an alphabet, identifying “capital A”, “lower-case q”, “question mark”, etc. There is a special term for a chunk of 8-bits: it’s called a byte. If your text file has 2500 characters, it will take at least 2500 bytes to store it in a file (plus extra).
Going back to my camera, I need to know 8 bits of information for each of 3 color channels (that’s 24 bits, or 3 bytes) for each pixel. 15 MP x 3 bytes/pixel = 45 MB (mega-bytes) for a single picture, uncompressed.
Files on computers are measured in bytes. Your hard drive holds, say, 200 GB (giga-bytes, giga = 1,000,000,000) which is the same as 200,000 MB. (This is a bit simplified, since the “mega” in mega-bytes is conventionally 1024, not 1000 (having to do with powers of 2) but, really, you don’t care. Just treat it as 1000.)
Since it’s hard to get a handle on what’s a big file, here are some comparisons.
- A 10-page 4200 word text document in Microsoft Word is 0.07 MB
- If you are on dial-up, an email JPG attachment of 1 or 2 MB is a noticeable delay, and 4 MB or more may prove to be a real nuisance.
- If you are on dial-up, a web page that has 1 MB of data takes a noticeable time to open in a browser.
- A typical 3 minute MP3 audio file is 2-6 MB.
- If you access the internet via satellite, you may be limited to upload/download traffic of 500 MB/day.
- A typical DVD runs about 30-70 MB/minute of video. (Online videos are smaller and lower resolution).
- A typical CD holds about 700 MB
Camera output & compression
Continuing my camera example, each picture needs 45 MB to describe all the information for all the pixels. So far, that’s just inside the camera (which has its own small computer). What goes onto my camera card? That depends on whether I am writing JPG files or raw files.
JPG is a type of file that is optimized for size. It is much smaller than the original, very widely used, and quite suitable for a large variety of applications including web display and most photo printing. It achieves this smaller file size by reducing the amount of information it carries, permanently. Once a picture has been converted to the JPG format, either inside your camera or in software afterward, you can’t get back to the original information.
Using our example, my original picture (4752 x 3168 pixels) has been cropped to produce an image that is 3113 x 2364 pixels, or 7.4 MP. This would take up 7.4 MP x 3 bytes/pixel = 21.6 MB as a file, without compression. A JPG output file is only 5.5 MB. (The web page example at the bottom of this article is 0.3 MB).
Cameras make trade-offs between speed and camera card capacity. They want the optimal reduced file size (so you can hold more on your camera card and write them more quickly) that preserves all the original information (for image manipulation in post-processing software) that doesn’t take too long to create (lots of calculations needed) so that you can click the shutter button again right away.
Each camera manufacturer (bless them) has a proprietary method of making raw files smaller without losing any information (lossless). For example, if my image has a dark shadow, one pixel can store 24 bits of information about it, but the next pixel, which is identical, can simply store a little information that says “I’m just like Charlie over there”. In real world situations, the file size needed is about 1 third the size of the original. My uncropped output files for a 15 MP camera range from 17-19 MB, instead of the 45 MB they would require without this lossless compression.
Matching intelligent proprietary software is needed to read these output files to turn them back into a grid of pixels so that you can manipulate the image in post-processing applications. For common camera brands, this is more or less automatic.
There’s one more small complication. When you look at your viewfinder to see the picture you just took, or when you look at a directory of pictures on your computer, what you see when you skim through those files are small thumbnails called previews which are also made by the camera (and other software), to make it easier to manage your image files. Those are written to a special area of the output file, along with metadata, information about the picture (date, camera model, settings, etc.).
Resolution – what’s right for different media
Now we can finally talk about resolution.
I’ve taken my picture, saved it in a raw format or JPG, and opened it up in my post-processing application (Photoshop, Lightroom, any of a great many tools). I’ve cropped it and don’t want to do anything else. It’s 3113 x 2364 pixels. Now what?
Remember old newspaper and comic book images? If you looked really closely, you could see that they were made up of individually colored dots but, if you held the image away from your eyes at the right distance, you no longer saw a bunch of dots but a smooth image. Printers today still create images that way, and “dots per inch” (DPI) is how they refer to the resolution of the picture. If there aren’t enough dots/inch for the right viewing distance, you will see the dots rather than a smooth image.
The right viewing distance matters. A billboard high up in Times Square has great big dots when you stand next to it, but looks just right from 100 feet away, which is how it is intended to be viewed. A framed photo on a wall might look much better from 2 feet than from 2 inches. What the human eye can see and resolve at the intended distance is the governing consideration.
Pixels aren’t dots, but the difference isn’t very important. Pixels are square, not round, and they are measured in “pixels per inch” (PPI), but the terms DPI and PPI are often used interchangeably. I will continue to use PPI here, but someone requesting a photo from you for publication is likely to use DPI.
Typical PPI or DPI resolutions:
- Image for a web page: 72 PPI (web pages need to be as small as possible)
- Conventional photo print: 240-300 PPI
- Conventional magazine or newspaper: 300-350 PPI
- High-resolution art print or art publication: 400-600 PPI
Notice that PPI and DPI are ratios: item/inch. By themselves, they don’t mean very much. I can take my file which is 3113 x 2364 pixels and make it any resolution I want without changing it a bit; all I’ve done is say how close together or far apart the pixels should be and it’s up to the output device to figure out how to display that. My example image at 300 PPI would be 10.4 inches (3113/300) x 7.9 inches (2364/300), more than enough for a magazine and perhaps enough for a calendar.
But what the magazine might actually want is a picture that is 3 inches wide at 300 PPI. That means I can’t just change the space between the pixels — I have to change the pixels themselves. The output file would need to be 900 pixels wide (3 inches at 300 PPI), but my original image is 3113 pixels wide. So what I need to do is resample the image.
Resampling takes the original information and summarizes it using fewer pixels. It creates a version of my image which has thrown some information away in order to represent as much as possible the same image using fewer pixels. It is also possible to resample an image to make it larger, but the software has to make up information to do it (based on nearby pixels) and there are very real limits on how much of that can be done without the effect becoming very obvious.
For magazines, I typically send my largest JPG file and let them change the resolution, resampling if necessary, as they choose to fit the space alotted. I check that the number of pixels is large enough to support the maximum space they are likely to need at their usual resolution, or else I warn them that the image they chose might be too small to use for that purpose. (If the image is 600 x 300 pixels, it won’t be magazine-usable at bigger than 2 x 1 inches, at 300 PPI.) I would prefer to send them a JPG files of exactly the right size based on the raw original, but that is rarely an option.
Images can look very good on a web page while still being remarkably low resolution. The example photo above is 72 PPI and takes up only 0.3 MB. An image that size printed at 72 PPI would be very unsatisfactory. What’s going on? Partly it’s because the image is illuminated which masks many small subtleties, and partly because my display device (the computer screen) is not really a high resolution device.
I have set the screen resolution for my laptop at 1680 x 1050 pixels, which is considered fairly high resolution for a computer screen. For general use I have set my laptop display so that the icons and text size are pleasing for me. In my case, that’s a density of 96 PPI (density being a synonym for resolution).
This is why images copied from the internet are very unsatisfactory when printed: insufficient information, which is the same as saying the wrong resolution for other purposes.