Memory Use by Images

Now that we know why we use RGB, let us get back to discussing the properties of an image. The most important issue regarding bit depth and resolution is the amount of memory an image takes. If the resolution and bit depth of an image requires more graphics memory than is available, you are out of luck. So how do you calculate how much memory any given resolution and bit depth requires?

The answer is simple. First, the resolution width is multiplied by the resolution height to obtain the total number of pixels at that resolution. Next, the bit depth is divided by 8 (to convert bits to bytes), and the result multiplied by the total number of pixels. The result is the number of bytes required for the specified resolution and bit depth. The calculation is as follows:

(Horizontal Resolution * Vertical Resolution) * (Bit Depth / 8) = Memory in bytes required.

For example:

(1024 * 768) * (24 / 8) = 2,359,296 bytes, or 2.35 megabytes

On that 4 megabyte card, at 24 bit depth, that's over half the available memory used up already! However, the calculation does not stop there. Depending on the video card and drivers, a factor called "pitch" needs to be taken into consideration. The pitch is an area of memory cache most commonly found on 3D accelerated cards used to speed up rendering operations. For every row of pixels in the current resolution, an unspecified number of bytes are used for the pitch. The size of the pitch is not defined until "run time", but it does need to be taken into consideration. So, the final calculation to find the memory used for any given resolution is as follows:

((Horizontal Resolution * Vertical Resolution) * (Bit Depth / 8)) + (Vertical Resolution * Pitch) = Memory in bytes required.

As we have discussed, A 24 bit mode can display up to 16,777,216 different colors, which is generally considered sufficient for the appearance of "true colour". However, 32 bit modes are also available. A 32 bit mode can display up to 4,294,967,296 different colors, which, when you consider that the human eye can only distinguish just over a million may seem a bit of a waste of memory. However, an interesting use for the extra bits is available - transparency. By using an extra byte (8 bits) for information, every pixel can have a transparency value from 0 - 255. This transparency effect is called an "alpha channel" and is used extensively in 32bit image formats (for example PNG) and in 3D graphics applications. (As a side note, these 32 bits fit nicely into a 4 byte type called a "DWORD".)

If you find CertiGuide.com useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than \$1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider buying an inexpensive PDF equivalent of the CertiGuide to A+ (A+ 4 Real) from StudyExam4Less.com. Thanks for your support!
 Donate \$2
 Donate \$5
 Donate \$10
 Donate \$20
 Donate \$30
 Donate: \$