The following entries are possible:īM Windows 3.1x, 95, NT. The header field used to identify the BMP and DIB file is 0x4D 0x42 in hexadecimal, same as BM in ASCII. All of the integer values are stored in little-endian format (i.e. The first 2 bytes of the BMP file format are the character "B" then the character "M" in ASCII encoding. A typical application reads this block first to ensure that the file is actually a BMP file and that it is not damaged. This block of bytes is at the start of the file and is used to identify the file. "Packed DIBs" are required by Windows clipboard API functions as well as by some Windows patterned brush and resource functions. For "packed DIBs" loaded in memory, the optional color profile data should immediately follow the pixel array, as depicted in diag. 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. In all cases, the pixel array must begin at a memory address that is a multiple of 4 bytes. 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 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 (unlike in diag. For DIBs loaded in memory, the color table can also consist of 16-bit entries that constitute indexes to the currently realized palette (an additional level of indirection), instead of explicit RGB color definitions. 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. Ī bitmap image file loaded into memory becomes a DIB data structure – an important component of the Windows GDI API. When loaded in memory as "non-packed DIB", it is located between the color table and Gap1. To define the color profile for color managementĬan also contain a path to an external file containing the color profile. Each row in the Pixel array is padded to a multiple of 4 bytes in sizeĪn artifact of the ICC profile data offset field in the DIB header The pixel format is defined by the DIB header or Extra bit masks. To define the actual values of the pixels To define colors used by the bitmap image data (Pixel array)Īn artifact of the File offset to Pixel array in the Bitmap file header Present only in case the DIB header is the BITMAPINFOHEADER and the Compression Method member is set to either BI_BITFIELDS or BI_ALPHABITFIELDS Immediately follows the Bitmap file header To store detailed information about the bitmap image and define the pixel format Not needed after the file is loaded in memory To store general information about the bitmap image file Referring to the diagram 1, the bitmap file is composed of structures in the following order: Many different versions of some of these structures can appear in the file, due to the long evolution of this file format. The bitmap image file consists of fixed-size structures (headers) as well as variable-sized structures appearing in a predetermined sequence. Also, not all fields are used a value of 0 will be found in these unused fields. Some applications create bitmap image files which are not compliant with the Microsoft documentation. The following sections discuss the data stored in the BMP file or DIB in detail. A DIB is normally transported in metafiles (usually using the StretchDIBits() function), BMP files, and the Clipboard ( CF_DIB data format). 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.). 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). They called these device-independent bitmaps or DIBs, and the file format for them is called DIB file format or BMP image file format.Ī device-independent bitmap (DIB) is a format used to define device-independent bitmaps in various color resolutions. 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. Please see the list below.Diagram 1 – The structure of the bitmap image file You can also compress other file formats.
0 Comments
Leave a Reply. |