|
|
(One intermediate revision by one other user not shown) |
Line 1: |
Line 1: |
| {{infobox file format
| | An underweight person can have low immunity, reduced endurance, along with a deficiency of nutrients in his body. So, weight control is important. There are many techniques to decide the ideal weight of the individual. Among them are, waist to height ratio, plus height to weight ratio.<br><br>No matter what you eat, always watch the part sizes. There is too much of the good thing! Watch out for cream based soups plus sauces; rather try tomato-based because a healthy alternative. Fried foods are a big no-no, have the fish and meats baked or grilled! Instead of the baked dessert, have fresh fruit. As another advantageous rule, utilize cooking spray instead of oils.<br><br>In 1972, Ancel Keys gave the concept its more familiar name, Body Mass Index, or BMI. In the 1980s, JS Garrow plus JD Webster recommended arbitrary zones for the BMI--including "overweight" and "obese". And the rest is history.<br><br>It is significant to note which fat is one of the many crucial factors associated to various diseases. Other important factors which ought to be taken into consideration while assessing the risks of chronic diseases include physical activity, blood stress, blood sugar level, plus diet to name just a few. BMI indicates the total body fat of an individual, that is measured through a [http://safedietplansforwomen.com/bmi-calculator bmi calculator females]. The calculator needs 2 pieces of information - fat inside kilograms or pounds and height in feet or centimeters.<br><br>Now, moderately active females are a small different! Woman at 119lbs could have 1,200 calories; 120 to 134 could have 1,400 calories; 135 to 144lbs 1,600 calories; and females that are 145lbs plus over should make certain that they receive 1,800 calories a day.<br><br>Many websites usually boast which is a person has a excellent BMI, he or she could lose weight. This is not true plus could occasionally result is serious wellness risks. Always consult an actual doctor if you're not certain. Never take the word of a company struggling to market their product!<br><br>If, inside a quest for how to lose weight, you have trouble staying motivated, and whom doesn't, there are numerous tips you are able to employ. The first is to find a friend who is furthermore trying to lose weight and go into this together. If you're there for each alternative, you'll be less likely to slip up inside a efforts. You might also tell oneself that you're going to buy oneself a reward when you hit you objective weight. For instance, we may purchase a modern pair of jeans or a hot exercise outfit. Putting up photos which are inspirational to you is another method to stay motivated. Finally, joining an official fat reduction program with weekly weigh-ins is a great method to remain with it. Knowing which you'll be facing your fellow weight loss partners and getting weighed inside publicly is a effective method to stay inspired. |
| | name = Windows Bitmap
| |
| | extension = .bmp, .dib
| |
| | mime = image/bmp,<br />image/x-bmp</code> (alias)
| |
| | type code = <tt>'BMP '</tt><br /><tt>'BMPf'</tt><br /><tt>'BMPp'</tt>
| |
| | uniform type = com.microsoft.bmp
| |
| | genre = [[Raster graphics]]
| |
| }}
| |
| The '''BMP file format''', also known as '''bitmap image file''' or '''device independent bitmap (DIB) file format''' or simply a '''bitmap''', is a [[raster graphics]] [[image file format]] used to store [[bitmap]] [[digital image]]s, independently of the [[display device]] (such as a graphics adapter), especially on [[Microsoft Windows]] and [[OS/2]] operating systems.
| |
| | |
| The BMP file format is capable of storing 2D digital images of arbitrary width, height, and resolution, both [[monochrome]] and color, in various [[color depth]]s, and optionally with [[data compression]], [[alpha compositing|alpha channel]]s, and [[color management|color profiles]].
| |
| | |
| == Device-independent bitmaps and the 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 or DIBs, and the file format for them is called DIB file format or BMP image file format.
| |
| | |
| According to Microsoft support:<ref name=DIBhelp>{{cite web | url = http://support.microsoft.com/kb/q81498/ | title = DIBs and Their Uses | work = Microsoft Help and Support | date = 2005-02-11}}</ref><blockquote>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).</blockquote>
| |
| | |
| The following sections discuss the data stored in the BMP file or DIB in detail. This is the standard BMP file format.<ref name=DIBhelp/> Some applications create bitmap image files which are not compliant with the current Microsoft documentation. Also, not all fields are used; a value of 0 will be found in these unused fields.
| |
| | |
| == File structure ==
| |
| The bitmap image file consists of fixed-size structures (headers) as well as variable-size structures appearing in a predetermined sequence. Many different versions of some of these structures can appear in the file, due to the long evolution of this file format.
| |
| | |
| [[File:BMPfileFormat.png|thumb|427px|Diag. 1 – The structure of the bitmap image file]]
| |
| | |
| Referring to the diagram 1, the bitmap file is composed of structures in the following order:
| |
| {| class="wikitable" style="width: 56%"
| |
| |-
| |
| ! Structure Name
| |
| ! Optional
| |
| ! Size
| |
| ! Purpose
| |
| ! Comments
| |
| |-
| |
| | '''Bitmap File Header'''
| |
| | No
| |
| | 14 Bytes
| |
| | To store general information about the Bitmap Image File
| |
| | Not needed after the file is loaded in memory
| |
| |-
| |
| | '''DIB Header'''
| |
| | No
| |
| | Fixed-size<br>(however 7 different versions exist)
| |
| | To store detailed information about the bitmap image and define the pixel format
| |
| | Immediately follows the Bitmap File Header
| |
| |-
| |
| | '''Extra bit masks'''
| |
| | Yes
| |
| | 3 or 4 DWORDs<ref name=AlphaBitFields/><br>(12 or 16 Bytes)
| |
| | To define the pixel format
| |
| | Present only in case the DIB Header is the BITMAPINFOHEADER
| |
| |-
| |
| | '''Color Table'''
| |
| | Semi-optional
| |
| | Variable-size
| |
| | To define colors used by the bitmap image data (Pixel Array)
| |
| | Mandatory for [[color depth]]s <= 8
| |
| |-
| |
| | '''Gap1'''
| |
| | Yes
| |
| | Variable-size
| |
| | Structure alignment
| |
| | An artifact of the File Offset to PixelArray in the Bitmap File Header
| |
| |-
| |
| | '''Pixel Array'''
| |
| | No
| |
| | Variable-size
| |
| | To define the actual values of the pixels
| |
| | The pixel format is defined by the DIB Header or Extra bit masks. Each row in the Pixel Array is padded to a multiple of 4 bytes in size
| |
| |-
| |
| | '''Gap2'''
| |
| | Yes
| |
| | Variable-size
| |
| | Structure alignment
| |
| | An artifact of the ICC Profile Data offset field in the DIB Header
| |
| |-
| |
| | '''ICC Color Profile'''
| |
| | Yes
| |
| | Variable-size
| |
| | To define the color profile for color management
| |
| | Can also contain a path to an external file containing the color profile. When loaded in memory as "non-packed DIB", it is located between the color table and gap1.<ref name=DIBHeaderTypes>MSDN [http://msdn.microsoft.com/en-us/library/dd183386%28VS.85%29.aspx Bitmap Header Types]</ref>
| |
| |}
| |
| | |
| === DIBs in memory ===
| |
| A bitmap image file loaded into memory becomes a DIB data structure – an important component of the Windows GDI API. The in-memory DIB data structure is almost the same as the BMP file format, but it does not contain the 14-byte bitmap file header and begins with the DIB header. For DIBs loaded in memory, the color table can also consist of 16 bit entries, that constitute indexes to the currently realized palette<ref name=BITMAPINFO>MSDN [http://msdn.microsoft.com/en-us/library/dd183375%28VS.85%29.aspx BITMAPINFO Structure]</ref> (an additional level of indirection), instead of explicit RGB color definitions. In all cases, the pixel array must begin at a memory address that is a multiple of 4 bytes. In non-packed DIBs loaded in memory, the optional color profile data should be located immediately after the color table and before the gap1 and pixel array<ref name=DIBHeaderTypes/> (unlike in diag. 1).
| |
| | |
| When the size of gap1 and gap2 is zero, the in-memory DIB data structure is customarily referred to as "packed DIB" and can be referred to by a single pointer pointing to the beginning of the DIB header. In all cases, the pixel array must begin at a memory address that is a multiple of 4 bytes. In some cases it may be necessary to adjust the number of entries in the color table in order to force the memory address of the pixel array to a multiple of 4 bytes.<ref name=BITMAPINFO/> For "packed DIBs" loaded in memory, the optional color profile data should immediately follow the pixel array, as depicted in diag. 1 (with gap1=0 and gap2=0).<ref name=DIBHeaderTypes/><br> "Packed DIBs" are required by [[Microsoft Windows|Windows]] clipboard API functions as well as by some Windows patterned brush and resource functions.<ref name=PackedDIB>Feng Yuan - Windows graphics programming: Win32 GDI and DirectDraw: [http://books.google.com/books?id=-O92IIF1Bj4C&pg=PA595 Packed Device-Independent Bitmap (CreateDIBPatternBrush, CreateDIBPatternBrushPt, FindResource, LoadResource, LockResource)]</ref>
| |
| | |
| === Bitmap file header ===
| |
| This block of bytes is at the start of the file and is used to identify the file. A typical application reads this block first to ensure that the file is actually a BMP file and that it is not damaged. The first two bytes of the BMP file format are the character 'B' then the character 'M' in 1-byte [[ASCII]] encoding. All of the integer values are stored in [[little-endian]] format (i.e. least-significant byte first).
| |
| | |
| {| class="wikitable" style="margin: 1em auto 1em auto"
| |
| |-
| |
| ! Offset#
| |
| ! Size
| |
| ! Purpose
| |
| |-
| |
| | 0000<sub>h</sub>
| |
| | 2 bytes
| |
| | the [[Magic number (programming)|header field]] used to identify the BMP & DIB file is 0x42 0x4D in [[hexadecimal]], same as BM in ASCII. The following entries are possible:
| |
| *'''BM''' – Windows 3.1x, 95, NT, ... etc.
| |
| *'''BA''' – OS/2 struct Bitmap Array
| |
| *'''CI''' – OS/2 struct Color Icon
| |
| *'''CP''' – OS/2 const Color Pointer
| |
| *'''IC''' – OS/2 struct Icon
| |
| *'''PT''' – OS/2 Pointer
| |
| |-
| |
| | 0002<sub>h</sub>
| |
| | 4 bytes
| |
| | the size of the BMP file in bytes
| |
| |-
| |
| | 0006<sub>h</sub>
| |
| | 2 bytes
| |
| | reserved; actual value depends on the application that creates the image
| |
| |-
| |
| | 0008<sub>h</sub>
| |
| | 2 bytes
| |
| | reserved; actual value depends on the application that creates the image
| |
| |-
| |
| | 000A<sub>h</sub>
| |
| | 4 bytes
| |
| | the offset, i.e. starting address, of the byte where the bitmap image data (pixel array) can be found.
| |
| |}
| |
| | |
| The size value occupies 4 bytes by default. However, with the use of the 4 reserved bytes, this value can occupy 8 bytes (64 bits) while still conforming to the BMPfile header format.
| |
| | |
| === DIB header (bitmap information header) ===
| |
| This block of bytes tells the application detailed information about the image, which will be used to display the image on the screen. The block also matches the header used internally by Windows and OS/2 and has several different variants. All of them contain a dword (32 bit) field, specifying their size, so that an application can easily determine which header is used in the image. The reason that there are different headers is that Microsoft extended the DIB format several times. The new extended headers can be used with some GDI functions instead of the older ones, providing more functionality. Since the GDI supports a function for loading bitmap files, typical Windows applications use that functionality. One consequence of this is that for such applications, the BMP formats that they support match the formats supported by the Windows version being run. See the table below for more information.
| |
| | |
| {| class="wikitable" style="margin: 1em auto 1em auto"
| |
| |- Windows V3 header
| |
| ! Size
| |
| ! Header Name
| |
| ! OS support
| |
| ! Features Added (incremental)
| |
| ! in Bitmap Files Written by
| |
| |-
| |
| | 12
| |
| | BITMAPCOREHEADER<br>OS21XBITMAPHEADER
| |
| | [[OS/2]] and also all Windows versions since [[Windows 3.0]]
| |
| |
| |
| |
| |
| |-
| |
| | 64
| |
| | BITMAPCOREHEADER2<br>OS22XBITMAPHEADER
| |
| | [[OS/2]]
| |
| | Adds halftoning. Adds RLE and Huffman 1D compression.
| |
| |
| |
| |-
| |
| | 40
| |
| | BITMAPINFOHEADER
| |
| | all Windows versions since [[Windows 3.0]]
| |
| | Removes RLE-24 and Huffman 1D compression. Adds 16bpp and 32bpp pixel formats. Adds optional RGB bit masks.
| |
| | Adobe Photoshop
| |
| |-
| |
| | 52
| |
| | BITMAPV2INFOHEADER
| |
| | Undocumented.
| |
| | Removes optional RGB bit masks. Adds mandatory RGB bit masks.
| |
| |
| |
| |-
| |
| | 56
| |
| | BITMAPV3INFOHEADER
| |
| | Undocumented.
| |
| | Adds mandatory alpha channel bit mask.
| |
| | Adobe Photoshop
| |
| |-
| |
| | 108
| |
| | BITMAPV4HEADER
| |
| | all Windows versions since Windows [[Windows 95|95]]/[[Windows NT 4.0|NT4]]
| |
| | Adds color space type and [[gamma correction]]
| |
| |
| |
| |-
| |
| | 124
| |
| | BITMAPV5HEADER
| |
| | Windows [[Windows 98|98]]/[[Windows 2000|2000]] and newer
| |
| | Adds [[ICC profile|ICC color profiles]]
| |
| |
| |
| |}
| |
| | |
| Versions after BITMAPCOREHEADER only add fields to the end of the header of the previous version.
| |
| For example: BITMAPV2INFOHEADER adds fields to BITMAPINFOHEADER and BITMAPV3INFOHEADER adds fields to BITMAPV2INFOHEADER (or, BITMAPINFOHEADER is a stripped version of BITMAPV2INFOHEADER)
| |
| | |
| For compatibility reasons, most applications use the older DIB headers for saving files. With OS/2 being obsolete, for now the common format is the BITMAPINFOHEADER header.
| |
| See next table for its description. All values are stored as unsigned integers, unless explicitly noted.
| |
| | |
| {| class="wikitable" style="margin: 1em auto 1em auto"
| |
| ! Offset #
| |
| ! Size
| |
| ! Purpose
| |
| |-
| |
| | 0Eh
| |
| | 4
| |
| | the size of this header (40 bytes)
| |
| |-
| |
| | 12h
| |
| | 4
| |
| | the bitmap width in pixels (signed integer).
| |
| |-
| |
| | 16h
| |
| | 4
| |
| | the bitmap height in pixels (signed integer).
| |
| |-
| |
| | 1Ah
| |
| | 2
| |
| | the number of color planes being used. Must be set to 1.
| |
| |-
| |
| | 1Ch
| |
| | 2
| |
| | the number of bits per pixel, which is the color depth of the image. Typical values are 1, 4, 8, 16, 24 and 32.
| |
| |-
| |
| | 1Eh
| |
| | 4
| |
| | the compression method being used. See the next table for a list of possible values.
| |
| |-
| |
| | 22h
| |
| | 4
| |
| | the image size. This is the size of the raw bitmap data (see below), and should not be confused with the file size.
| |
| |-
| |
| | 26h
| |
| | 4
| |
| | the horizontal resolution of the image. (pixel per meter, signed integer)
| |
| |-
| |
| | 2Ah
| |
| | 4
| |
| | the vertical resolution of the image. (pixel per meter, signed integer)
| |
| |-
| |
| | 2Eh
| |
| | 4
| |
| | the number of colors in the color palette, or 0 to default to 2<sup>''n''</sup>.
| |
| |-
| |
| | 32h
| |
| | 4
| |
| | the number of important colors used, or 0 when every color is important; generally ignored.
| |
| |}
| |
| | |
| Note: The image size field can be 0 for BI_RGB bitmaps.
| |
| | |
| The compression method field (bytes #30-33) can have the following values:
| |
| | |
| {| class="wikitable" style="margin: 1em auto 1em auto"
| |
| |-
| |
| ! Value
| |
| ! Identified by
| |
| ! Compression method
| |
| ! Comments
| |
| |-
| |
| | 0
| |
| | BI_RGB
| |
| | none
| |
| | Most common
| |
| |-
| |
| | 1
| |
| | BI_RLE8
| |
| | [[Run-length encoding|RLE]] 8-bit/pixel
| |
| | Can be used only with 8-bit/pixel bitmaps
| |
| |-
| |
| | 2
| |
| | BI_RLE4
| |
| | RLE 4-bit/pixel
| |
| | Can be used only with 4-bit/pixel bitmaps
| |
| |-
| |
| | 3
| |
| | BI_BITFIELDS
| |
| | Bit field or Huffman 1D compression for BITMAPCOREHEADER2
| |
| | Pixel format defined by bit masks or Huffman 1D compressed bitmap for BITMAPCOREHEADER2
| |
| |-
| |
| | 4
| |
| | BI_JPEG
| |
| | JPEG or RLE-24 compression for BITMAPCOREHEADER2
| |
| | The bitmap contains a [[JPEG]] image or RLE-24 compressed bitmap for BITMAPCOREHEADER2
| |
| |-
| |
| | 5
| |
| | BI_PNG
| |
| | PNG
| |
| | The bitmap contains a [[Portable Network Graphics|PNG]] image
| |
| |-
| |
| | 6
| |
| | BI_ALPHABITFIELDS
| |
| | Bit field
| |
| | This value is valid in Windows CE .NET 4.0 and later.
| |
| |}
| |
| | |
| Note: BI_JPEG and BI_PNG are for printer drivers and are not supported when rendering to the screen.<ref>
| |
| {{cite web | url = http://msdn.microsoft.com/en-us/library/dd145023(VS.85).aspx | title = JPEG and PNG Extensions for Specific Bitmap Functions and Structures}}</ref>
| |
| | |
| The OS/2 BITMAPCOREHEADER header is also popular: | |
| | |
| {| class="wikitable" style="margin: 1em auto 1em auto"
| |
| |-
| |
| ! Offset
| |
| ! Size
| |
| ! Purpose
| |
| |-
| |
| | 0Eh
| |
| | 4
| |
| | the size of this header (12 bytes)
| |
| |-
| |
| | 12h
| |
| | 2
| |
| | the bitmap width in pixels.
| |
| |-
| |
| | 14h
| |
| | 2
| |
| | the bitmap height in pixels.
| |
| |-
| |
| | 16h
| |
| | 2
| |
| | the number of color planes; 1 is the only legal value
| |
| |-
| |
| | 18h
| |
| | 2
| |
| | the number of bits per pixel. Typical values are 1, 4, 8 and 24.
| |
| |}
| |
| | |
| Note: OS/2 BITMAPCOREHEADER bitmaps cannot be compressed and cannot be 16 or 32 bits/pixel. All values in the OS/2 BITMAPCOREHEADER header are unsigned integers.
| |
| | |
| A 16-bit and 32-bit version of DIB with an integrated alpha channel has been introduced with the undocumented BITMAPV3INFOHEADER and with the documented BITMAPV4HEADER (since [[Windows 95]]) and is used within [[Windows XP]] logon and theme system as well as Microsoft Office (since v2000); it is supported by some [[image editing]] software, such as [[Adobe Photoshop]] since version 7 and [[Adobe Flash]] since version MX 2004 (then known as Macromedia Flash). It is also supported by [[GIMP]], [[Google Chrome]], [[Microsoft PowerPoint|MS-PowerPoint]] and MS-Word.
| |
| | |
| === Color table ===
| |
| The color table (palette) occurs in the BMP image file directly after the BMP file header, the DIB header (and after optional three red, green and blue bitmasks if the BITMAPINFOHEADER header with BI_BITFIELDS option is used). Therefore, its offset is the size of the BITMAPFILEHEADER plus the size of the DIB header (plus optional 12 bytes for the three bit masks).<br>
| |
| <small>''Note: On [[Windows CE]] the BITMAPINFOHEADER header can be used with the BI_ALPHABITFIELDS<ref name=AlphaBitFields>MSDN - BITMAPINFOHEADER: [http://msdn.microsoft.com/en-us/library/aa452885.aspx BI_ALPHABITFIELDS in biCompression member]</ref> option in the biCompression member. In such case, four optional bitmasks follow the BITMAPINFOHEADER header instead of the three bitmasks mentioned above, thus the color table's offset is the size of the BITMAPFILEHEADER plus the size of the BITMAPINFOHEADER header plus the 16 bytes of the four bitmasks (red, green, blue and alpha).''</small> | |
| | |
| The number of entries in the palette is either 2<sup>''n''</sup> or a smaller number specified in the header (in the OS/2 BITMAPCOREHEADER header format, only the full-size palette is supported).<ref name=DIBhelp/><ref name=OS2gff>{{cite web | url = http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm | title = GFF Format Summary: OS/2 Bitmap}}</ref> In most cases, each entry in the color table occupies 4 bytes, in the order blue, green, red, 0x00 (see below for exceptions). This is indexed in the BITMAPINFOHEADER under the function biBitCount.
| |
| | |
| The color table is a block of bytes (a table) listing the colors used by the image. Each pixel in an indexed color image is described by a number of bits (1, 4, or 8) which is an index of a single color described by this table. The purpose of the color palette in indexed color bitmaps is to inform the application about the actual color that each of these index values corresponds to. The purpose of the color table in non-indexed (non-palettized) bitmaps is to list the colors used by the bitmap for the purposes of optimization on devices with limited color display capability and to facilitate future conversion to different pixel formats and paletization.
| |
| | |
| The colors in the color table are usually specified in the 4-byte per entry [[RGBAX|8.8.8.0.8]] format (in [[RGBAX]] notation). The color table used with the OS/2 BITMAPCOREHEADER uses the 3-byte per entry [[RGBAX|8.8.8.0.0]] format.<ref name=DIBhelp/><ref name=OS2gff/> For DIBs loaded in memory, the color table can optionally consist of 2-byte entries - these entries constitute indexes to the currently realized palette<ref name=BITMAPINFO/> instead of explicit RGB color definitions.
| |
| | |
| Microsoft does not disallow the presence of a valid alpha channel bit mask<ref>MSDN - BITMAPV4HEADER: [http://msdn.microsoft.com/en-us/library/dd183380%28VS.85%29.aspx The member bV4AlphaMask]</ref> in BITMAPV4HEADER and BITMAPV5HEADER for 1bpp, 4bpp and 8bpp indexed color images, which indicates that the color table entries can also specify an alpha component using the [[RGBAX|8.8.8.[0-8].[0-8]]] format via the RGBQUAD.rgbReserved<ref>MSDN - RGBQUAD: [http://msdn.microsoft.com/en-us/library/dd162938%28VS.85%29.aspx rgbReserved member]</ref> member. However, some versions of Microsoft's documentation disallow this feature by stating that the RGBQUAD.rgbReserved member "must be zero".
| |
| | |
| As mentioned above, the color table is normally not used when the pixels are in the 16-bit per pixel (16bpp) format (and higher); there are normally no color table entries in those bitmap image files. However, the Microsoft documentation (on the MSDN web site as of Nov. 16, 2010<ref>see note under biClrUsed [http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376(v=vs.85).aspx MSDN BITMAPINFOHEADER]</ref>) specifies that for 16bpp (and higher), the color table can be present to store a list of colors intended for optimization on devices with limited color display capability, while it also specifies, that in such cases, no indexed palette entries are present in this Color Table. This may seem like a contradiction if no distinction is made between the mandatory palette entries and the optional color list.
| |
| | |
| === Pixel storage ===
| |
| The bits representing the bitmap pixels are [[packed]] in rows. The size of each row is rounded up to a multiple of 4 bytes (a 32-bit [[DWORD]]) by padding.<br>
| |
| For images with height > 1, multiple padded rows are stored consecutively, forming a Pixel Array.
| |
| | |
| The total number of bytes necessary to store one row of pixels can be calculated as:
| |
| :<math>\mbox{RowSize} = \left\lfloor\frac { \mbox{BitsPerPixel} \cdot \mbox{ImageWidth}+31
| |
| }{32}\right\rfloor \cdot 4,</math>
| |
| :''ImageWidth'' is expressed in pixels.
| |
| | |
| The total amount of bytes necessary to store an array of pixels in an <var>n</var> bits per pixel (bpp) image, with [[power of two|2<sup><var>n</var></sup>]] colors, can be calculated by accounting for the effect of rounding up the size of each row to a multiple of a 4 bytes, as follows:
| |
| | |
| :<math>\mbox{PixelArraySize} = \mbox{RowSize} \cdot \left | \mbox{ImageHeight} \right \vert </math>
| |
| :''ImageHeight'' is expressed in pixels. The absolute value is necessary because ImageHeight can be negative
| |
| | |
| The total bitmap image file size can be approximated as:
| |
| :<math>\mbox{FileSize} \approx 54 + 4 \cdot 2^\mbox{bpp} + \mbox{PixelArraySize}</math>,
| |
| :for ''BPP'' ≤ 8 ( because for pixels larger than 8 bits, the [[palette (computing)|palette]] is not mandatory )
| |
| | |
| Only images with 8 or fewer bits per pixel must account for the palette. 16bpp images (or higher), may omit the palette part from the size calculation, as follows:
| |
| | |
| :<math>\mbox{FileSize} \approx 54 + \mbox{PixelArraySize}</math>,
| |
| :for ''Bits per Pixel'' > 8.
| |
| | |
| In the formulas above, the number 54 is the combined size of the 14 byte bitmap file header and the 40 byte popular WindowsDIB header – the BITMAPINFOHEADER (some other DIB header versions will be larger or smaller than that as described by the table above) and the expression <math>4 \cdot 2^n</math> is the size of the color palette in bytes.
| |
| | |
| This total file size formula is only an approximation, since the size of the color palette will be <math>3 \cdot 2^n</math> bytes for the OS/2 DIB header version BITMAPCOREHEADER, and some files may define only the number of colors needed by the image, potentially fewer than <math>2^n</math>.<ref name=DIBhelp/><br>
| |
| An additional size uncertainty is introduced by the optional presence of the 12 or 16 bytes needed for the extra bit masks stored immediately after the BITMAPINFOHEADER DIB header and the variable-size GAP depicted in Diag.1
| |
| | |
| ==== Pixel array (bitmap data) ====
| |
| The pixel array is a block of 32-bit DWORDs, that describes the image pixel by pixel. Normally pixels are stored "upside-down" with respect to normal image [[raster scan]] order, starting in the lower left corner, going from left to right, and then row by row from the bottom to the top of the image.<ref name=DIBhelp/><br>
| |
| Unless BITMAPCOREHEADER is used, uncompressed Windows bitmaps also can be stored from the top to bottom, when the Image Height value is negative.
| |
| | |
| In the original OS/2 DIB, the only four legal values of color depth were 1, 4, 8, and 24 bits per pixel (bpp).<ref name=DIBhelp/>
| |
| Contemporary DIB Headers allow pixel formats with 1, 2, 4, 8, 16, 24 and 32 bits per pixel (bpp).<ref>MSDN - BITMAPINFOHEADER: [http://msdn.microsoft.com/en-us/library/dd183376%28VS.85%29.aspx The member biBitCount]</ref>
| |
| | |
| Padding bytes (not necessarily 0) must be appended to the end of the rows in order to bring up the length of the rows to a multiple of four bytes. When the pixel array is loaded into memory, each row must begin at a memory address that is a multiple of 4. This address/offset restriction is mandatory only for Pixel Arrays loaded in memory. For file storage purposes, only the size of each row must be a multiple of 4 bytes while the file offset can be arbitrary.<ref name=DIBhelp/><br>
| |
| A 24-bit 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 2 bytes of padding, Width=3 would have 3 bytes of padding, and Width=4 would not have any padding at all.
| |
| | |
| Bitmap image files are typically much larger than image file formats compressed with other algorithms, for the same image. For example, the 1058×1058 [[:Image:Wikipedia-logo.png|Wikipedia logo]], which occupies about 271 kB in the lossless [[Portable Network Graphics|PNG]] format, takes about 3358 kB as a 24bpp BMP image file. Uncompressed formats are generally unsuitable for transferring images on the internet or other slow or capacity-limited media.
| |
| | |
| ==== Compression ====
| |
| [[palette (computing)|Indexed]] color images may be compressed with 4-bit or 8-bit [[Run-length encoding|RLE]] or [[Huffman coding|Huffman]] 1D algorithm.<br>
| |
| [[OS/2]] BITMAPCOREHEADER2 [[color depth|24bpp]] images may be compressed with the 24-bit RLE algorithm.<br>
| |
| The [[color depth|16bpp]] and [[color depth|32bpp]] images are ''always'' stored uncompressed.<br>
| |
| Note that images in all color depths can be stored without compression if so desired.
| |
| | |
| ==== Pixel format ====
| |
| In a bitmap image file on a disk or a bitmap image in memory, the pixels can be defined by a varying number of bits.
| |
| | |
| :* The 1-bit per pixel (1bpp) format supports 2 distinct colors, (for example: black and white). The pixel values are stored in each bit, with the first (left-most) pixel in the most-significant bit of the first byte.<ref name=DIBhelp/> Each bit is an index into a table of 2 colors. An unset bit will refer to the first color table entry, and a set bit will refer to the last (second) color table entry.
| |
| :* The 2-bit per pixel (2bpp) format supports 4 distinct colors and stores 4 pixels per 1 byte, the left-most pixel being in the two most significant bits ([[Windows CE]] only<ref name=PSformats>MSDN: [http://msdn.microsoft.com/en-us/library/ms959648.aspx Windows CE - BITMAPINFOHEADER Structure]</ref>). Each pixel value is a 2-bit index into a table of up to 4 colors.
| |
| :* The 4-bit per pixel (4bpp) format supports 16 distinct colors and stores 2 pixels per 1 byte, the left-most pixel being in the more significant [[nibble]].<ref name=DIBhelp/> Each pixel value is a 4-bit index into a table of up to 16 colors.
| |
| :* The 8-bit per pixel (8bpp) format supports 256 distinct colors and stores 1 pixel per 1 byte. Each byte is an index into a table of up to 256 colors.
| |
| :* The 16-bit per pixel (16bpp) format supports 65536 distinct colors and stores 1 pixel per 2 byte WORD. Each WORD can define the alpha, red, green and blue [[Sample (graphics)|samples]] of the pixel.
| |
| | |
| :* The 24-bit pixel (24bpp) format supports 16,777,216 distinct colors and stores 1 pixel value per 3 bytes. Each pixel value defines the red, green and blue samples of the pixel (8.8.8.0.0 in RGBAX notation). Specifically in the order (blue, green and red, 8-bits per each sample).<ref name=DIBhelp/>
| |
| | |
| :* The 32-bit per pixel (32bpp) format supports 4,294,967,296 distinct colors and stores 1 pixel per 4 byte DWORD. Each DWORD can define the Alpha, Red, Green and Blue samples of the pixel.
| |
| | |
| In order to resolve the ambiguity of which bits define which samples, the DIB Headers provide certain defaults as well as specific BITFIELDS which are bit masks that define the membership of particular group of bits in a pixel to a particular [[Channel (digital image)|channel]].<br> The following diagram defines this mechanism:
| |
| | |
| [[Image:BitfieldsSLN.png|none|left|100%|The BITFIELDS mechanism depicted in RGBAX sample length notation]]
| |
| Diag. 2 – The BITFIELDS mechanism for a 32 bit pixel depicted in RGBAX sample length notation
| |
| | |
| The sample fields defined by the BITFIELDS bit masks have to be contiguous and non-overlapping but the order of the sample fields is arbitrary. The most ubiquitous field order is: Alpha, Blue, Green, Red (MSB to LSB).<br>
| |
| The red, green and blue bit masks are valid only when the Compression member of the DIB header is set to BI_BITFIELDS.<br>
| |
| The alpha bit mask is valid whenever it is present in the DIB header or when the Compression member of the DIB header is set to BI_ALPHABITFIELDS<ref name=AlphaBitFields/> ([[Windows CE]] only).
| |
| | |
| [[Image:SLNotation44440.png|none|left|100%|The BITFIELDS mechanism depicted in RGBAX sample length notation]]
| |
| Diag.3 – The pixel format with an alpha channel in a 16 bit pixel (in RGBAX sample Length notation) actually generated by Adobe Photoshop<ref name=PSformats>Adobe Photoshop: [http://livedocs.adobe.com/en_US/Photoshop/10.0/WSfd1234e1c4b69f30ea53e41001031ab64-7751.html BMP Format]</ref>
| |
| | |
| ::::The table below lists all of the possible pixel formats of a DIB (in RGBAX notation).
| |
| | |
| [[Image:AllBMPformats.png|none|left|100%|All of the possible pixel formats in a DIB]]
| |
| | |
| The BITFIELD mechanism described above allows for the definition of tens of thousands different pixel formats, however only several of them are used in practice,<ref name="PSformats"/> such as:
| |
| * 8.8.8.0.0
| |
| * 8.8.8.0.8
| |
| * 8.8.8.8.0
| |
| * 5.5.5.0.1
| |
| * 5.5.5.1.0
| |
| * 5.6.5.0.0
| |
| * 4.4.4.0.4
| |
| * 4.4.4.4.0
| |
| * All palettized formats (marked in yellow in the table above)
| |
| | |
| === Example 1 ===
| |
| | |
| Following is an example of a 2×2 pixel, 24-bit bitmap (Windows DIB header BITMAPINFOHEADER) with pixel format 8.8.8.0.0 (in RGBAX notation).
| |
| | |
| [[Image:Bmp format.svg|frame|right|Example of a 2×2 pixel bitmap, with 24 bits/pixel encoding]]
| |
| | |
| {| class="wikitable" style="margin: 1em auto 1em auto"
| |
| ! style="padding: 0px 10px" | Offset
| |
| ! style="padding: 0px 10px" | Size
| |
| ! style="padding: 0px 10px" | Hex Value
| |
| ! style="padding: 0px 10px" | Value
| |
| ! style="padding: 0px 10px" | Description
| |
| |-
| |
| | colspan="5" style="text-align: center;" | BMP Header
| |
| |-
| |
| | align="center" |0h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>42 4D</code>
| |
| | style="padding: 0px 10px"|"BM"
| |
| | style="padding: 0px 10px"|ID field (42h, 4Dh)
| |
| |-
| |
| | align="center" |2h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>46 00 00 00</code>
| |
| | style="padding: 0px 10px"|70 Bytes
| |
| | style="padding: 0px 10px"|Size of the BMP file
| |
| |-
| |
| | align="center" |6h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>00 00</code>
| |
| | style="padding: 0px 10px"|Unused
| |
| | style="padding: 0px 10px"|Application specific
| |
| |-
| |
| | align="center" |8h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>00 00</code>
| |
| | style="padding: 0px 10px"|Unused
| |
| | style="padding: 0px 10px"|Application specific
| |
| |-
| |
| | align="center" |Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>36 00 00 00</code>
| |
| | style="padding: 0px 10px"|54 bytes
| |
| | style="padding: 0px 10px"|Offset where the pixel array (bitmap data) can be found
| |
| |-
| |
| | colspan="5" style="text-align: center;" | DIB Header
| |
| |-
| |
| | align="center" |Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>28 00 00 00</code>
| |
| | style="padding: 0px 10px"|40 bytes
| |
| | style="padding: 0px 10px"|Number of bytes in the DIB header (from this point)
| |
| |-
| |
| | align="center" |12h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>02 00 00 00</code>
| |
| | style="padding: 0px 10px"|2 pixels (left to right order)
| |
| | style="padding: 0px 10px"|Width of the bitmap in pixels
| |
| |-
| |
| | align="center" |16h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>02 00 00 00</code>
| |
| | style="padding: 0px 10px"|2 pixels (bottom to top order)
| |
| | style="padding: 0px 10px"|Height of the bitmap in pixels. Positive for bottom to top pixel order. Negative for top to bottom pixel order.
| |
| |-
| |
| | align="center" |1Ah
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>01 00</code>
| |
| | style="padding: 0px 10px"|1 plane
| |
| | style="padding: 0px 10px"|Number of color planes being used
| |
| |-
| |
| | align="center" |1Ch
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>18 00 </code>
| |
| | style="padding: 0px 10px"|24 bits
| |
| | style="padding: 0px 10px"|Number of bits per pixel
| |
| |-
| |
| | align="center" |1Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0
| |
| | style="padding: 0px 10px"|BI_RGB, no pixel array compression used
| |
| |-
| |
| | align="center" |22h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>10 00 00 00</code>
| |
| | style="padding: 0px 10px"|16 bytes
| |
| | style="padding: 0px 10px"|Size of the raw data in the pixel array (including padding)
| |
| |-
| |
| | align="center" |26h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>13 0B 00 00</code>
| |
| | style="padding: 0px 10px"|2,835 pixels/meter
| |
| | style="padding: 0px 10px"|Horizontal resolution of the image
| |
| |-
| |
| | align="center" |2Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>13 0B 00 00</code>
| |
| | style="padding: 0px 10px"|2,835 pixels/meter
| |
| | style="padding: 0px 10px"|Vertical resolution of the image
| |
| |-
| |
| | align="center" |2Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 colors
| |
| | style="padding: 0px 10px"|Number of colors in the palette
| |
| |-
| |
| | align="center" |32h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 important colors
| |
| | style="padding: 0px 10px"|0 means all colors are important
| |
| |-
| |
| | colspan="5" align="center"|Start of pixel array (bitmap data)
| |
| |-
| |
| | align="center" |36h
| |
| | align="center" |3
| |
| | style="padding: 0px 20px"|<code>00 00 FF</code>
| |
| | style="padding: 0px 10px"|0 0 255
| |
| | style="padding: 0px 10px"|Red, Pixel (0,1)
| |
| |-
| |
| | align="center" |39h
| |
| | align="center" |3
| |
| | style="padding: 0px 20px"|<code>FF FF FF</code>
| |
| | style="padding: 0px 10px"|255 255 255
| |
| | style="padding: 0px 10px"|White, Pixel (1,1)
| |
| |-
| |
| | align="center" |3Ch
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>00 00</code>
| |
| | style="padding: 0px 10px"|0 0
| |
| | style="padding: 0px 10px"|Padding for 4 byte alignment (could be a value other than zero)
| |
| |-
| |
| | align="center" |3Eh
| |
| | align="center" |3
| |
| | style="padding: 0px 20px"|<code>FF 00 00</code>
| |
| | style="padding: 0px 10px"|255 0 0
| |
| | style="padding: 0px 10px"|Blue, Pixel (0,0)
| |
| |-
| |
| | align="center" |41h
| |
| | align="center" |3
| |
| | style="padding: 0px 20px"|<code>00 FF 00</code>
| |
| | style="padding: 0px 10px"|0 255 0
| |
| | style="padding: 0px 10px"|Green, Pixel (1,0)
| |
| |-
| |
| | align="center" |44h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>00 00</code>
| |
| | style="padding: 0px 10px"|0 0
| |
| | style="padding: 0px 10px"|Padding for 4 byte alignment (could be a value other than zero)
| |
| |}
| |
| | |
| === Example 2 ===
| |
| Following is an example of a 4×2 pixel, 32-bit bitmap with opacity values in the alpha channel (Windows DIB Header BITMAPV4HEADER) with pixel format 8.8.8.8.0 (in RGBAX notation).
| |
| | |
| [[Image:Bmp format2.svg|frame|right|Example of a 4×2 pixel bitmap, with 32 bits/pixel encoding]]
| |
| {| class="wikitable" style="margin: 1em auto 1em auto;"
| |
| ! style="padding: 0px 10px" | Offset
| |
| ! style="padding: 0px 10px" | Size
| |
| ! style="padding: 0px 10px" | Hex Value
| |
| ! style="padding: 0px 10px" | Value
| |
| ! style="padding: 0px 10px" | Description
| |
| |-
| |
| | colspan="5" style="text-align: center;" | BMP Header
| |
| |-
| |
| | align="center" |0h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>42 4D</code>
| |
| | style="padding: 0px 10px"|"BM"
| |
| | style="padding: 0px 10px"|Magic number (unsigned integer 66, 77)
| |
| |-
| |
| | align="center" |2h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>9A 00 00 00</code>
| |
| | style="padding: 0px 10px"|154 Bytes
| |
| | style="padding: 0px 10px"|Size of the BMP file
| |
| |-
| |
| | align="center" |6h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>00 00</code>
| |
| | style="padding: 0px 10px"|Unused
| |
| | style="padding: 0px 10px"|Application specific
| |
| |-
| |
| | align="center" |8h
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>00 00</code>
| |
| | style="padding: 0px 10px"|Unused
| |
| | style="padding: 0px 10px"|Application specific
| |
| |-
| |
| | align="center" |Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>7A 00 00 00</code>
| |
| | style="padding: 0px 10px"|122 bytes from the start of the file
| |
| | style="padding: 0px 10px"|Offset where the pixel array (bitmap data) can be found
| |
| |-
| |
| | colspan="5" style="text-align: center;" | DIB Header
| |
| |-
| |
| | align="center" |Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>6C 00 00 00</code>
| |
| | style="padding: 0px 10px"|108 bytes
| |
| | style="padding: 0px 10px"|Number of bytes in the DIB header (from this point)
| |
| |-
| |
| | align="center" |12h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>04 00 00 00</code>
| |
| | style="padding: 0px 10px"|4 pixels (left to right order)
| |
| | style="padding: 0px 10px"|Width of the bitmap in pixels
| |
| |-
| |
| | align="center" |16h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>02 00 00 00</code>
| |
| | style="padding: 0px 10px"|2 pixels (bottom to top order)
| |
| | style="padding: 0px 10px"|Height of the bitmap in pixels
| |
| |-
| |
| | align="center" |1Ah
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>01 00</code>
| |
| | style="padding: 0px 10px"|1 plane
| |
| | style="padding: 0px 10px"|Number of color planes being used
| |
| |-
| |
| | align="center" |1Ch
| |
| | align="center" |2
| |
| | style="padding: 0px 20px"|<code>20 00 </code>
| |
| | style="padding: 0px 10px"|32 bits
| |
| | style="padding: 0px 10px"|Number of bits per pixel
| |
| |-
| |
| | align="center" |1Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>03 00 00 00</code>
| |
| | style="padding: 0px 10px"|3
| |
| | style="padding: 0px 10px"|BI_BITFIELDS, no pixel array compression used
| |
| |-
| |
| | align="center" |22h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>20 00 00 00</code>
| |
| | style="padding: 0px 10px"|32 bytes
| |
| | style="padding: 0px 10px"|Size of the raw data in the pixel array (including padding)
| |
| |-
| |
| | align="center" |26h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>13 0B 00 00</code>
| |
| | style="padding: 0px 10px"|2,835 pixels/meter
| |
| | style="padding: 0px 10px"|Horizontal physical resolution of the image
| |
| |-
| |
| | align="center" |2Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>13 0B 00 00</code>
| |
| | style="padding: 0px 10px"|2,835 pixels/meter
| |
| | style="padding: 0px 10px"|Vertical physical resolution of the image
| |
| |-
| |
| | align="center" |2Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 colors
| |
| | style="padding: 0px 10px"|Number of colors in the palette
| |
| |-
| |
| | align="center" |32h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 important colors
| |
| | style="padding: 0px 10px"|0 means all colors are important
| |
| |-
| |
| | align="center" |36h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 FF 00</code>
| |
| | style="padding: 0px 10px"|00FF0000 in big-endian
| |
| | style="padding: 0px 10px"|Red channel bit mask (valid because BI_BITFIELDS is specified)
| |
| |-
| |
| | align="center" |3Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 FF 00 00</code>
| |
| | style="padding: 0px 10px"|0000FF00 in big-endian
| |
| | style="padding: 0px 10px"|Green channel bit mask (valid because BI_BITFIELDS is specified)
| |
| |-
| |
| | align="center" |3Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>FF 00 00 00</code>
| |
| | style="padding: 0px 10px"|000000FF in big-endian
| |
| | style="padding: 0px 10px"|Blue channel bit mask (valid because BI_BITFIELDS is specified)
| |
| |-
| |
| | align="center" |42h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 FF</code>
| |
| | style="padding: 0px 10px"|FF000000 in big-endian
| |
| | style="padding: 0px 10px"|Alpha channel bit mask
| |
| |-
| |
| | align="center" |46h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>20 6E 69 57</code>
| |
| | style="padding: 0px 10px"|LCS_WINDOWS_COLOR_SPACE
| |
| | style="padding: 0px 10px"|Type of Color Space
| |
| |-
| |
| | align="center" |4Ah
| |
| | align="center" |24h
| |
| | style="padding: 0px 20px"|<code>24* 00...00</code>
| |
| | style="padding: 0px 10px"|CIEXYZTRIPLE Color Space endpoints
| |
| | style="padding: 0px 10px"|Unused when LCS_WINDOWS_COLOR_SPACE is specified
| |
| |-
| |
| | align="center" |6Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 Red Gamma
| |
| | style="padding: 0px 10px"|Unused when LCS_WINDOWS_COLOR_SPACE is specified
| |
| |-
| |
| | align="center" |72h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 Green Gamma
| |
| | style="padding: 0px 10px"|Unused when LCS_WINDOWS_COLOR_SPACE is specified
| |
| |-
| |
| | align="center" |76h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 00 00</code>
| |
| | style="padding: 0px 10px"|0 Blue Gamma
| |
| | style="padding: 0px 10px"|Unused when LCS_WINDOWS_COLOR_SPACE is specified
| |
| |-
| |
| | colspan="5" align="center"|Start of the Pixel Array (the bitmap Data)
| |
| |-
| |
| | align="center" |7Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>FF 00 00 7F</code>
| |
| | style="padding: 0px 10px"|255 0 0 127
| |
| | style="padding: 0px 10px"|Blue (Alpha: 127), Pixel (0,1)
| |
| |-
| |
| | align="center" |7Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 FF 00 7F</code>
| |
| | style="padding: 0px 10px"|0 255 0 127
| |
| | style="padding: 0px 10px"|Green (Alpha: 127), Pixel (1,1)
| |
| |-
| |
| | align="center" |82h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 FF 7F</code>
| |
| | style="padding: 0px 10px"|0 0 255 127
| |
| | style="padding: 0px 10px"|Red (Alpha: 127), Pixel (2,1)
| |
| |-
| |
| | align="center" |86h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>FF FF FF 7F</code>
| |
| | style="padding: 0px 10px"|255 255 255 127
| |
| | style="padding: 0px 10px"|White (Alpha: 127), Pixel (3,1)
| |
| |-
| |
| | align="center" |8Ah
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>FF 00 00 FF</code>
| |
| | style="padding: 0px 10px"|255 0 0 255
| |
| | style="padding: 0px 10px"|Blue (Alpha: 255), Pixel (0,0)
| |
| |-
| |
| | align="center" |8Eh
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 FF 00 FF</code>
| |
| | style="padding: 0px 10px"|0 255 0 255
| |
| | style="padding: 0px 10px"|Green (Alpha: 255), Pixel (1,0)
| |
| |-
| |
| | align="center" |92h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>00 00 FF FF</code>
| |
| | style="padding: 0px 10px"|0 0 255 255
| |
| | style="padding: 0px 10px"|Red (Alpha: 255), Pixel (2,0)
| |
| |-
| |
| | align="center" |96h
| |
| | align="center" |4
| |
| | style="padding: 0px 20px"|<code>FF FF FF FF</code>
| |
| | style="padding: 0px 10px"|255 255 255 255
| |
| | style="padding: 0px 10px"|White (Alpha: 255), Pixel (3,0)
| |
| |}
| |
| | |
| Note that the bitmap data starts with the lower left hand corner of the image.
| |
| | |
| == Usage of BMP format ==
| |
| The simplicity of the BMP file format, and its widespread familiarity in Windows and elsewhere, as well as the fact that this format is relatively well [[documentation|documented]] and free of patents, makes it a very common format that image processing programs from many operating systems can read and write.
| |
| | |
| Many older [[graphical user interface]]s used bitmaps in their built-in graphics subsystems;<ref>{{cite book | title = Cross-Platform GUI Programming with Wxwidgets | author = Julian Smart, Stefan Csomor, and Kevin Hock | url = http://books.google.com/books?id=CyMsvtgnq0QC&pg=PA265&dq=bitmap+pixmap+gui| publisher = Prentice Hall | year = 2006 | isbn = 0-13-147381-6 }}</ref> for example, the Microsoft Windows and OS/2 platforms' [[Graphics Device Interface|GDI]] subsystem, where the specific format used is the ''Windows and OS/2 bitmap file format'', usually named with the [[file extension]] of <code>.BMP</code> or <code>.DIB</code>.
| |
| | |
| While most BMP files have a relatively large file size due to lack of any compression (or generally low-ratio [[run-length encoding]] on palletized images), many BMP files can be considerably compressed with [[lossless data compression]] algorithms such as [[ZIP (file format)|ZIP]] because they contain redundant data. Some formats, such as [[RAR]], even include routines specifically targeted at efficient compression of such data.
| |
| | |
| == Related formats ==
| |
| {{Main|Image file formats}}
| |
| The [[X Window System]] uses a similar [[X Bitmap|XBM]] format for black-and-white images, and [[X PixMap|XPM]] (''pixelmap'') for color images. There are also a variety of "raw" formats, which saves raw data with no other information. The [[Portable Pixmap]] (PPM) and [[Truevision TGA]] formats also exist, but are less often used – or only for special purposes; for example, TGA can contain transparency information.
| |
| | |
| Numerous other bitmap file formats are in existence, though most are not widely used.<ref>{{cite web | url = http://www.file-extensions.org/filetype/extensions/name/Bitmap+image/
| |
| | title = List of bitmap file types | work = Search File-Extensions.org}}</ref>
| |
| | |
| == See also ==
| |
| * [[Comparison of graphics file formats]]
| |
| | |
| == References ==
| |
| {{reflist}}
| |
| | |
| == External links ==
| |
| * [http://atlc.sourceforge.net/bmp.html#_toc381201084 Bitmap Format], at sourceforge.net
| |
| * [http://www.digicamsoft.com/bmp/bmp.html Bitmap File Structure], at digicamsoft.com
| |
| * [http://www.herdsoft.com/ti/davincie/imex3j8i.htm An introduction to DIBs (Device Independent Bitmaps)], at herdsoft.com
| |
| * [http://vaxa.wvnet.edu/vmswww/bmp.html BMP test images], at wvnet.edu
| |
| * [http://www.kalytta.com/bitmap.h A simple bitmap loader C++ class], at kalytta.com
| |
| * [http://doscoy.github.io/libbmp24 libbmp24] at github. portable and simple C++ open source project. bitmap image library.
| |
| * [http://drdobbs.com/architecture-and-design/184409517 The BMP File Format, Part 1 By David Charlap] at Dr. Dobb's journal of software tools (drdobbs.com), March 1995
| |
| * [http://www.fileformat.info/format/bmp/egff.htm Microsoft Windows Bitmap File Format Summary], at fileformat.info
| |
| * [http://netghost.narod.ru/gff/graphics/summary/micbmp.htm Microsoft bitmap v2 and v3 formats], archived at netghost.narod.ru
| |
| * [http://netghost.narod.ru/gff/graphics/summary/os2bmp.htm OS/2 bitmap formats], archived at netghost.narod.ru
| |
| | |
| {{Compression formats}}
| |
| {{Graphics file formats}}
| |
| | |
| {{DEFAULTSORT:Bmp File Format}}
| |
| [[Category:Graphics file formats]]
| |
| [[Category:Microsoft Windows multimedia technology]]
| |