ArticleslgStudy

computer science

Bitmap

Bitmap is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Bitmap rather than just read about it. In short: In computing, a bitmap (also called raster) graphic is an image formed from a grid of pixels, each assigned a color value. A GIF is an example of a graphics image file that uses a bitmap.

Key takeaways

  • Bitmap belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Bitmap to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Bitmap from memory before moving on to harder problems.

Reference excerpt

In computing, a bitmap (also called raster) graphic is an image formed from a grid of pixels, each assigned a color value. A GIF is an example of a graphics image file that uses a bitmap. As a noun, the term "bitmap" is very often used to refer to a particular bitmapping application: the pix-map, which refers to a map of pixels, where each pixel may use more than one bit, allowing it to represent more than two colors, thus using more than one bit per pixel. In such a case, the domain in question is the array of pixels which constitute a digital graphic output device (a screen or monitor). In some contexts, the term bitmap implies one bit per pixel, whereas pixmap is used for images with multiple bits per pixel. A bitmap is a type of memory organization or image file format used to store digital images. The term bitmap comes from the computer programming terminology, meaning just a map of bits, a spatially mapped array of bits. Now, along with pixmap, it commonly refers to the similar concept of a spatially mapped array of pixels. Raster images in general may be referred to as bitmaps or pixmaps, whether synthetic or photographic, in files or memory. Many graphical user interfaces use bitmaps in their built-in graphics subsystems. For example, the Microsoft Windows and OS/2 platforms' GDI subsystem uses the Windows and OS/2 bitmap file format, usually named with the file extension .BMP (or .DIB for device-independent bitmap). Besides BMP, other file formats that store literal bitmaps include InterLeaved Bitmap (ILBM), Portable Bitmap (PBM), X Bitmap (XBM), and Wireless Application Protocol Bitmap (WBMP). Similarly, most other image file formats, such as JPEG, TIFF, PNG, and GIF, also store bitmap images (as opposed to vector graphics), but they are not usually referred to as bitmaps, it's mostly a matter of convention rather than any technical distinction.

Pixel storage In typical uncompressed bitmaps, image pixels are generally stored with a variable number of bits per pixel which identify its color (the color depth). Pixels of 8 bits and fewer can represent either grayscale or indexed color. An alpha channel (for transparency) may be stored in a separate bitmap, where it is similar to a grayscale bitmap, or in a fourth channel that, for example, converts 24-bit images to 32 bits per pixel. The bits representing the bitmap pixels may be packed or unpacked (spaced out to byte or word boundaries), depending on the format or device requirements. Depending on the color depth, a pixel in the picture will occupy at least n/8 bytes, where n is the bit depth. For an uncompressed, packed-within-rows bitmap, such as is stored in Microsoft DIB or BMP file format, or in uncompressed TIFF format, a lower bound on storage size for a n-bit-per-pixel (2n colors) bitmap, in bytes, can be calculated as:

size=width⋅height⋅n/8 where width and height are given in pixels. In the formula above, header size and color palette size, if any, are not included. Due to effects of row padding to align each row start to a storage unit boundary, such as a word, additional bytes may be needed.

Device-independent bitmaps and BMP file format

Microsoft has defined a particular representation of color bitmaps of different color depths, as an aid to exchanging bitmaps between devices and applications with a variety of internal representations. They called these device-independent bitmaps "DIBs", and the file format for them is called DIB file format or BMP file format. According to Microsoft support:

A device-independent bitmap (DIB) is a format used to define device-independent bitmaps in various color resolutions. The main purpose of DIBs is to allow bitmaps to be moved from one device to another (hence, the device-independent part of the name). A DIB is an external format, in contrast to a device-dependent bitmap, which appears in the system as a bitmap object (created by an application...). A DIB is normally transported in metafiles (usually using the StretchDIBits() function), BMP files, and the Clipboard (CF_DIB data format).

Here, "device independent" refers to the format, or storage arrangement, and should not be confused with device-independent color.

Other bitmap file formats

The X Window System uses a similar XBM format for black-and-white images, and XPM (pixelmap) for color images. Numerous other uncompressed bitmap file formats are in use, though most not widely. For most purposes, standardized compressed bitmap files such as GIF, PNG, TIFF, and JPEG are used. Lossless compression in particular provides the same information as a bitmap in a smaller file size. TIFF and JPEG have various options. JPEG is usually lossy compression. TIFF is usually either uncompressed, or lossless Lempel–Ziv–Welch compressed like GIF. PNG uses deflate lossless compression, another Lempel-Ziv variant. There are also a variety of "raw" image files, which store raw bitmaps with no other information. Such raw files are just bitmaps in files, often with no header or size information (they are distinct from photographic raw image formats, which store raw unprocessed sensor data in a structured container such as TIFF format along with extensive image metadata).

See also Free space bitmap, an array of bits that tracks which disk storage blocks are in-use Raster graphics Raster scan Rasterization Sprite (computer graphics) Voxels Vector graphics Image tracing

References

Worked examples

Example 1 — a first encounter with Bitmap

Start with the simplest possible case. Write down what Bitmap claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Bitmap before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Bitmap ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Bitmap

In research
Bitmap appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Bitmap in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Bitmap is common in secondary-school and first-year university syllabi. It links to neighbouring topics Bit data structures, Graphics file formats, so understanding it makes those chapters shorter.
In everyday life
Look for Bitmap outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Bitmap” →

How to study Bitmap in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Bitmap means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Bitmap out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Bitmap in simple terms?

In computing, a bitmap (also called raster) graphic is an image formed from a grid of pixels, each assigned a color value. A GIF is an example of a graphics image file that uses a bitmap.

Why does Bitmap matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Bitmap?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Bitmap.

Tags

  • Bit data structures
  • Graphics file formats

Keep exploring