A few scanning tips

www.scantips.com

Google
Web   scantips.com

Memory cost of images

Large images consume large memory and make our computers struggle. Memory cost for an image is computed from the image size.

For a 6x4 inch image at 150 dpi, the image size is calculated as:

  (6 inches × 150 dpi) × (4 inches × 150 dpi) = 900 × 600 pixels

900 × 600 pixels is 900 × 600 = 540,000 pixels.

The memory cost for this RGB color image is:

  900 × 600 × 3 = 1.6 million bytes.

The last "× 3" is for 3 bytes of RGB color information per pixel for 24 bit color (3 RGB values per pixel, one 8-bit byte for each RGB value, which totals 24 bit color).

Different color modes have different size values, as shown below:

Image Type   Bytes per pixel
1 bit Line art   1/8 byte per pixel
(1 bit per pixel, 8 bits per byte)
8 bit Grayscale   1 byte per pixel
16 bit Grayscale   2 bytes per pixel
24 bit RGB   3 bytes per pixel
Most common for photos, for example JPG
32 bit CMYK   4 bytes per pixel
For Prepress
48 bit RGB   6 bytes per pixel

About Megabytes

Most programs will show the memory size of images in megabytes. You may notice a little discrepancy from the number you calculate. This is because (as regarding memory sizes) "megabytes" and "millions of bytes" are not quite the same units.

A million bytes is 1000x1000 = 1,000,000 bytes, powers of 10, or 106. But binary units normally are used for memory sizes, powers of 2, where 1K is 1024 bytes, and a megabyte is 1024x1024 = 1,048,576 bytes, or 220.

So, a number like 10 million bytes is 10,000,000 / (1024x1024) = 9.54 megabytes (same as 10 / 1.048). One megabyte holds nearly 5% more bytes than one million, so there are about 5% fewer megabytes.

There are technical reasons that memory chip addressing uses binary units, so data size in memory often does too. That difference was important in the old days when computer chips only had 2 KB of memory which would hold 2048 bytes of data, but it is not very important today.

A digital camera's megapixels and a disk drive's megabytes are both advertised as decimal millions (1000x1000). The definition of Mega does mean millions of course (decimal factors of 1000), it is just that memory chips are dimensioned in binary units (factors of 1024). To preserve the actual decimal meanings of Mega and Kilo, new SI units Mi and Ki were defined for the binary powers of 1024, but they have not caught on.

Note that you will see different units for the same dimension:

  1. Photo editors normally show image size in MB (uncompressed bytes divided by 1024x1024).
  2. The Windows Explorer shows the file size in units of KB (bytes divided by 1024 once). But a larger factor is that the file is probably compressed, so the file on disk is likely smaller than the image size.
  3. The Windows command line DIR command shows exact decimal file size in bytes. The operating system only records file size in decimal bytes, but it tends to show humans the value in binary KB or MB. I cannot think of any reason why that convention is retained today.

Notice that when you increase resolution, the size formula above multiplies the memory cost by that resolution number twice, in both width and height. The memory cost for an image increases as the square of the resolution. The square of say 300 dpi is a pretty large number (more than double the square of 200).

When people ask how to fix memory errors when scanning at 9600 dpi, the answer is to use 300 dpi if you don't have 8 gigabytes of memory, or a 9600 dpi scanner.

Scanning any 6x4 inch photo will consume the amounts of memory shown in the table below. I hope you realize that it rapidly becomes impossible.

Scan
Resolution
6x4 inch
Image Size
(pixels)
Pixel
Count
Memory size in bytes
24 bit RGB Color 8 bit Grayscale Line art
75 dpi 450x300 135,000 405,000 135,000 16,875
150 dpi 900x600 540,000 1,620,000 540,000 67,500
300 dpi 1800x1200 2,160,000 6,480,000 2,160,000 270,000
600 dpi 3600x2400 8,640,000 25,920,000 8,640,000 1,080,000
1200 dpi 7200x4800 34,560,000 103,680,000 34,560,000 4,320,000
2400 dpi 14400x9600 138,240,000 414,720,000 138,240,000 17,280,000
4800 dpi 28800x19200 552,960,000 1,658,880,000 552,960,000 69,120,000
9600 dpi 57600x38400 2,211,840,000 6,635,520,000 2,211,840,000 276,480,000

When we double the scan resolution, memory cost goes up 4 times. Multiply resolution by 3 and the memory cost increases 9 times, etc. So this seems a very clear argument to use only the amount of resolution we actually need to improve the image results for the job purpose. More than that is waste. It's often even painful. Well, virtual pain.  <grin>


Copyright © 1997-2008 by Wayne Fulton - All rights are reserved.

Previous Main Next