What is DPI?
I got a question today from a colleague about dpi. Specifically, what’s the difference between a digital image with certain dimensions (say, 600 by 400 pixels) if it’s saved at 72 dpi versus 300 dpi. It’s a common question and very misunderstood. So after stammering around a bit, I told him I’d give him a definitive answer after I had a chance to make sure I knew what I was talking about. And I didn’t. So here’s the real story.
Observe the following three images:
The left one is 150 x 100 pixels at 72 dpi. The file size is 12,014 bytes.
The middle one is 150 x 100 pixels at 300 dpi. The file size is 12,016 bytes.
The right one is 150 x 100 pixels at 10,000 dpi. The file size is 12,020 bytes.
What is the difference between them? There isn’t any difference save one (which my peer has no doubt already figured out if he’s read this far, since he’s a computer scientist). They are all the exact same image. DPI, or ‘dots per inch’ is a measure of resolution that is only enforced when you print an image. When displayed on a computer screen, it is irrelevant. Monitor resolution is commonly stated as ‘72 dpi’, but even that is a misnomer. Monitors have pixels, not dots. Printers have dots. Dots and pixels are totally not the same thing. So a monitor is 72 pixels per inch (PPI). But not all of them. Mine is 96 ppi, for example.
The real size of the rendered image on the monitor is simply (150 pixels / 96 ppi) x (100 pixels / 96 ppi). In fact, you can even stick a ruler up against your monitor and measure an answer close to the calculation above. (The pixels aren’t necessarily all square and perfect for an exact measurement.)
So what is dpi used for? When you set the dpi it is to tell a printer how large you want the image to be. The printer uses the same math as above, just using the dpi setting you used when you saved the image to a file.
There are two rules of thumb here:
- If you are saving an image for display on a computer screen, forget about dpi and just go by the pixel dimensions (i.e., 150 x 100 pixels)
- If you are saving an image for printing, forget about the pixel dimensions. Set the dpi and then set the size of the image width and height in inches or centimeters (depending on your locale)
Now for the pop quiz. If the files are all the same, why are they all a slightly different size?
The answer is that within a JPG (which these are), the dpi setting you used is actually encoded into the file. The file sizes are different because the integer representing the dpi setting is larger going from left to right: 72 -> 300 -> 10000 = two digits -> three digits -> five digits. The extra bytes are for storing that number. Empirically we can see that it takes two bytes to store one digit. That probably means that the value is being written as a string. If you don’t follow that, it doesn’t matter – please be assured it has nothing to do with how good your photos look.














