BMP file format
≈ 5 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
The BMP file format, also known as bitmap image file, the Windows Bitmap file format, or simply bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapter). The underlying device-independent bitmap representation is commonly called a DIB: it consists of a DIB header, optional color information, and pixel data, describing the image independently of the display device; a BMP file wraps such a DIB in an additional 14-byte file header.
Evidence and sources
It originated in the closely linked early development of Microsoft Windows and OS/2, whose bitmap formats were at first identical; ; used by the GDI subsystem of both platforms, it is sometimes called the Windows and OS/2 bitmap file format and is usually named with the file extension or . The BMP file format is capable of storing two-dimensional digital images in various color depths, and optionally with data compression, alpha channels, and color profiles.
The format's simplicity, its familiarity on Windows, and its status as a relatively well-documented, open format have made it very widely supported, so that image-processing programs on many operating systems can read and write BMP files. The same bitmap structure is embedded in related Windows formats: ICO and CUR files, for example, contain images that begin with a .…
The BMP file format, also known as bitmap image file, the Windows Bitmap file format, or simply bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapter). The underlying device-independent bitmap representation is commonly called a DIB: it consists of a DIB header, optional color information, and pixel data, describing the image independently of the display device; a BMP file wraps such a DIB in an additional 14-byte file header.
It originated in the closely linked early development of Microsoft Windows and OS/2, whose bitmap formats were at first identical; ; used by the GDI subsystem of both platforms, it is sometimes called the Windows and OS/2 bitmap file format and is usually named with the file extension or . The BMP file format is capable of storing two-dimensional digital images in various color depths, and optionally with data compression, alpha channels, and color profiles.
The format's simplicity, its familiarity on Windows, and its status as a relatively well-documented, open format have made it very widely supported, so that image-processing programs on many operating systems can read and write BMP files. The same bitmap structure is embedded in related Windows formats: ICO and CUR files, for example, contain images that begin with a . Because uncompressed BMP files hold a great deal of redundant data, they can often be reduced substantially by general-purpose lossless compression such as ZIP or RAR.
Impact
The bitmap header structures were documented from the outset in Microsoft's general Windows and OS/2 programmer's references rather than in a specification dedicated to BMP alone; a formal specification of the same structures, using normative language, was only later folded into the Windows Metafile (WMF) specification, which Microsoft placed under its Open Specification Promise. \text{RowSize} = \left\lceil\frac { \text{BitsPerPixel} \cdot \text{ImageWidth}}{32}\right\rceil \cdot 4 = \left\lfloor\frac { \text{BitsPerPixel} \cdot \text{ImageWidth}+31}{32}\right\rfloor \cdot 4, For images with height above 1, multiple padded rows are stored consecutively, forming the pixel array, whose total size can be calculated by accounting for the effect of rounding up the size of each row to a multiple of 4 bytes, as follows: \text{PixelArraySize} = \text{RowSize} \cdot |\text{ImageHeight}| When the pixel array is loaded into memory, each row must begin at a memory address that is a multiple of 4; this restriction applies only in memory — for file storage, only the size of each row must be a multiple of 4 bytes, while the offset of the pixel array itself can be arbitrary.
A 24 bpp bitmap with Width=1 would have 3 bytes of data per row (blue, green, red) and 1 byte of padding, while Width=2 would have 6 bytes of data and 2 bytes of padding, Width=3 would have 9 bytes of data and 3 bytes of padding, and Width=4 would have 12 bytes of data and no padding.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1376057605 under CC BY-SA 4.0; modifications have been made.