In
computing
Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, e ...
, a bitmap is a mapping from some domain (for example, a range of integers) to
bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represente ...
s. It is also called a
bit array
A bit array (also known as bitmask, bit map, bit set, bit string, or bit vector) is an array data structure that compactly stores bits. It can be used to implement a simple set data structure. A bit array is effective at exploiting bit-level p ...
or
bitmap index.
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
pixel
In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device.
In most digital display devices, pixels are the smal ...
s, where each one may store 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
Memory is the faculty of the mind by which data or information is encoded, stored, and retrieved when needed. It is the retention of information over time for the purpose of influencing future action. If past events could not be remembered, ...
organization or
image file format
An Image file format is a file format for a digital image. There are many formats that can be used, such as JPEG, Portable Network Graphics, PNG, and GIF. Most formats up until 2022 were for storing 2D images, not 3D ones. The data stored in an ...
used to store
digital image
A digital image is an image composed of picture elements, also known as ''pixels'', each with ''finite'', '' discrete quantities'' of numeric representation for its intensity or gray level that is an output from its two-dimensional functions ...
s. The term ''bitmap'' comes from the
computer programming
Computer programming is the process of performing a particular computation (or more generally, accomplishing a specific computing result), usually by designing and building an executable computer program. Programming involves tasks such as ana ...
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
Raster may refer to:
* Raster graphics, graphical techniques using arrays of pixel values
* Raster graphics editor, a computer program
* Raster scan, the pattern of image readout, transmission, storage, and reconstruction in television and compu ...
images in general may be referred to as bitmaps or pixmaps, whether synthetic or photographic, in files or memory.
Many
graphical user interface
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
s use bitmaps in their built-in graphics subsystems; for example, the
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
and
OS/2
OS/2 (Operating System/2) is a series of computer operating systems, initially created by Microsoft and IBM under the leadership of IBM software designer Ed Iacobucci. As a result of a feud between the two companies over how to position OS/2 ...
platforms'
GDI
GDI may refer to:
Science and technology
* Gasoline direct injection, a type of fuel injection
* Graphics Device Interface, a component of Microsoft Windows
* Guanosine nucleotide dissociation inhibitor, a protein
Organisations
* Gabriel Dumont I ...
subsystem, where the specific format used is the ''Windows and OS/2 bitmap file format'', usually named with the
file extension
A filename extension, file name extension or file extension is a suffix to the name of a computer file (e.g., .txt, .docx, .md). The extension indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
of
.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
JPEG ( ) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and imag ...
,
TIFF
Tag Image File Format, abbreviated TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processin ...
,
PNG, and
GIF
The Graphics Interchange Format (GIF; or , see pronunciation) is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on 15 June 1987. ...
, also store bitmap images (as opposed to
vector graphics
Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display a ...
), but they are not usually referred to as ''bitmaps'', since they use
compressed formats internally.
Pixel storage
In typical
uncompressed bitmaps, image
pixel
In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device.
In most digital display devices, pixels are the smal ...
s are generally stored with a variable number of bits per pixel which identify its color, the
color depth
Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component of a single pixel. When referring to ...
. Pixels of 8 bits and fewer can represent either
grayscale
In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an ''amount'' of light; that is, it carries only intensity information. Graysca ...
or
indexed color
In computing, indexed color is a technique to manage digital images' colors in a limited fashion, in order to save computer memory and file storage, while speeding up display refresh and file transfers. It is a form of vector quantization compr ...
. An
alpha channel
In computer graphics, alpha compositing or alpha blending is the process of combining one image with a background to create the appearance of partial or full transparency. It is often useful to render picture elements (pixels) in separate pas ...
(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
Data structure alignment is the way data is arranged and accessed in computer memory. It consists of three separate but related issues: data alignment, data structure padding, and packing.
The CPU in modern computer hardware performs reads and ...
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
The BMP file format, also known as bitmap image file, device independent bitmap (DIB) file format and bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapt ...
, or in uncompressed
TIFF
Tag Image File Format, abbreviated TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processin ...
format, a lower bound on storage size for a n-bit-per-pixel (2
n colors) bitmap, in
byte
The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
s, can be calculated as:
:
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
A word is a basic element of language that carries an semantics, objective or pragmatics, practical semantics, meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of w ...
, additional bytes may be needed.
Device-independent bitmaps and BMP file format
Microsoft has defined a particular representation of color bitmaps of different
color depth
Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component of a single pixel. When referring to ...
s, as an aid to exchanging bitmaps between devices and applications with a variety of internal representations. They called these device-independent bitmaps as DIBs, and the file format for them is called DIB file format or
BMP file format
The BMP file format, also known as bitmap image file, device independent bitmap (DIB) file format and bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapt ...
. 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
The X Window System (X11, or simply X) is a windowing system for bitmap displays, common on Unix-like operating systems.
X provides the basic framework for a GUI environment: drawing and moving windows on the display device and interacting wit ...
uses a similar
XBM
In computer graphics, the X Window System used X BitMap (XBM), a plain text binary image format, for storing cursor and icon bitmaps used in the X GUI. The XBM format is superseded by XPM, which first appeared for X11 in 1989.
Format
XBM fil ...
format for
black-and-white
Black-and-white (B&W or B/W) images combine black and white in a continuous spectrum, producing a range of shades of grey.
Media
The history of various visual media began with black and white, and as technology improved, altered to color. ...
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
The Graphics Interchange Format (GIF; or , see pronunciation) is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on 15 June 1987. ...
,
PNG,
TIFF
Tag Image File Format, abbreviated TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processin ...
, and
JPEG
JPEG ( ) is a commonly used method of lossy compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and imag ...
are used;
lossless compression
Lossless compression is a class of data compression that allows the original data to be perfectly reconstructed from the compressed data with no loss of information. Lossless compression is possible because most real-world data exhibits statistic ...
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
In information technology, lossy compression or irreversible compression is the class of data compression methods that uses inexact approximations and partial data discarding to represent the content. These techniques are used to reduce data size ...
. TIFF is usually either uncompressed, or lossless
Lempel-Ziv-Welch compressed like
GIF
The Graphics Interchange Format (GIF; or , see pronunciation) is a bitmap image format that was developed by a team at the online services provider CompuServe led by American computer scientist Steve Wilhite and released on 15 June 1987. ...
. PNG uses
deflate lossless compression, another
Lempel-Ziv
LZ77 and LZ78 are the two lossless data compression algorithms published in papers by Abraham Lempel and Jacob Ziv in 1977 and 1978.
They are also known as LZ1 and LZ2 respectively. These two algorithms form the basis for many variations includin ...
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 format
A camera raw image file contains unprocessed or minimally processed data from the image sensor of either a digital camera, a motion picture film scanner, or other image scanner. Raw files are named so because they are not yet processed and the ...
s, which store raw unprocessed sensor data in a structured container such as
TIFF
Tag Image File Format, abbreviated TIFF or TIF, is an image file format for storing raster graphics images, popular among graphic artists, the publishing industry, and photographers. TIFF is widely supported by scanning, faxing, word processin ...
format along with extensive image
metadata
Metadata is "data that provides information about other data", but not the content of the data, such as the text of a message or the image itself. There are many distinct types of metadata, including:
* Descriptive metadata – the descriptive ...
).
See also
*
Free space bitmap
Free-space bitmaps are one method used to track allocated sectors by some file systems. While the most simplistic design is highly inefficient, advanced or hybrid implementations of free-space bitmaps are used by some modern file systems.
Examp ...
, an array of bits that tracks which disk storage blocks are in-use
*
Raster graphics
upright=1, The Smiley, smiley face in the top left corner is a raster image. When enlarged, individual pixels appear as squares. Enlarging further, each pixel can be analyzed, with their colors constructed through combination of the values for ...
*
Raster scan
A raster scan, or raster scanning, is the rectangular pattern of image capture and reconstruction in television. By analogy, the term is used for raster graphics, the pattern of image storage and transmission used in most computer bitmap image s ...
*
Rasterization
In computer graphics, rasterisation (British English) or rasterization (American English) is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (a series of pixels, dots or lines, whic ...
*
Sprite (computer graphics)
Sprite commonly refers to:
* Sprite (drink), a lemon-lime beverage produced by the Coca-Cola Company
* Sprite (computer graphics), a smaller bitmap composited onto another by hardware or software
* Sprite (folklore), a type of legendary creature i ...
*
Voxels
In 3D computer graphics, a voxel represents a value on a regular grid in three-dimensional space. As with pixels in a 2D bitmap, voxels themselves do not typically have their position (i.e. coordinates) explicitly encoded with their values. Ins ...
*
Vector graphics
Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display a ...
References
{{Authority control
Map
A map is a symbolic depiction emphasizing relationships between elements of some space, such as objects, regions, or themes.
Many maps are static, fixed to paper or some other durable medium, while others are dynamic or interactive. Although ...
Graphics file formats
ca:Mapa de bits
es:Gráfico rasterizado
fr:Bitmap
it:Bitmap