- Pixels and Paths
- Pixels and Images
- Resolution
- How Much Is Enough?
- Resampling
- Image Mode
- Bitmaps and File Size
- Billions and Billions of Bits
Bitmaps and File Size
As we said at the beginning of this chapter, pixel-based images are rectangles with thousands (or even millions) of pixels. Each of those pixels has to be saved on disk. If each pixel is defined using 8 bits of color information, then the file is eight times bigger than a black-and-white bitmap. Similarly, a 24-bit file is a full three times bigger than the 8-bit image, and a 48-bit file is twice the size of a 24-bit one.
Big files take a long time to open, edit, print, or save. Many people who complain about how slow editing is in Photoshop are simply working with files much bigger than they need. Instead, you can save yourself the complaining and reduce your file size when you can. Here's a quick rundown of how each attribute of a pixel-based image affects file size.
Dimensions and resolution
When you increase the number of pixels, you increase the file's size by the square of the value. That means if you double the resolution, you quadruple the file size (2 x 2); triple the resolution, and your file is nine times as large (3 x 3). There can easily be a multimegabyte difference between a 300-ppi and a 225-ppi image. (And remember that a 225-ppi image is almost always plenty enough resolution for a 150-lpi halftone screen.)
Bit depth
Increasing bit depth increases file size by a simple multiplier. Therefore, a 24-bit image is three times as large as an 8-bit image, and 24 times as large as a 1-bit image.
Image mode
Image mode doesn't necessarily increase file size, but going from RGB (24-bit) to CMYK (32-bit) mode does. It adds an extra 8-bit channel, thereby increasing bit depth (because each pixel is 32 bits deep).
Figuring File Size
Now that you know the factors that affect the size of images, it's a simple matter to calculate file size using the following formula:
File size in kilobytes =
Resolution2 x Width x Height x Bits per sample ÷ 8,192
For example, if you have a 4-by-5-inch, 1-bit image at 300 ppi, you know that the file size is 220 K (3002 x 4 x 5 x 1 ÷ 8192). A 24-bit image of the same size would be 5,273 K (just about 5 MB). In case you were wondering, this formula works because 8,192 is the number of bits in a kilobyte.
Of course, all these calculations apply only to flat files. When you start adding layers, layer masks, and alpha channels, it becomes quite difficult to figure file size with any degree of reliability. Each channel or mask adds another 8 or 16 bits to the bit depth (depending on whether the document was in 8-bit/channel or 16-bit/channel mode), but layers are much harder to figure because Photoshop divides each layer into tiles. Empty tiles take up almost no space, but if a tile contains just one pixel, it takes up the same amount of space as a tile that's full of pixels. It's possible, and sometimes useful, to place layered TIFF or Photoshop files in a page-layout application, but we recommend flattening all files before final handoff to keep final files to a manageable size.
Some file formats also offer compression options. It's important to bear in mind that the file size that Photoshop reports is always the amount of RAM that the uncompressed, flattened image will occupy. We'll discuss compression options and file formats in much greater detail in Chapter 13, Image Storage and Output.