BMP Image

From XentaxWiki
Revision as of 13:25, 5 January 2021 by imported>Ikskoks (→‎Format Specifications)
Jump to navigation Jump to search

BMP


Format Specifications

// BMP file format (image)

// little endian

// header
2 bytes (char) - magic // "BM"
4 bytes (uint32) - size of the BMP file
4 bytes - reserved
4 bytes (uint32) - offset of image data

// DIB header --> Info header (40 bytes) OR Core header (12 bytes) etc.
// See more details in notes below.

// Info header
4 bytes (uint32) - size of info header
4 bytes (uint32) - bitmap width in pixels
4 bytes (uint32) - bitmap height in pixels
2 bytes (uint16) - number of color planes   // must be "1"
2 bytes (uint16) - number of bits per pixel // "1" - monochrome pelette, num_colors=1
                                            // "4" - 4bit palettized, num_colors=16
                                            // "8" - 8bit palettized, num_colors=256
                                            // "16" - 16bit RGB, num_colors=65536
                                            // "24" - 24bit RGB, num_colors=16M
                                            // "32" - 32bit RGB
2 bytes (uint16) - compression type  // "0" - BI_RGB, no compression
                                     // "1" - BI_RLE8, 8bit RLE encoding
                                     // "2" - BI_RLE4, 4bit RLE encoding
                                     // "3" - BI_BITFIELDS, Huffman 1D 
                                     // "4" - BI_JPEG, RLE-24
                                     // "5" - BI_PNG 
                                     // "6" - BI_ALPHABITFIELDS 
                                     // "11" - BI_CMYK 
                                     // "12" - BI_CMYKRLE8 
                                     // "13" - BI_CMYKRLE4 
4 bytes (uint32) - compressed image size   // can be 0 if compression=0
4 bytes (int32) - horizontal resolution (pixels per metre)
4 bytes (int32) - vertical resolution (pixels per metre)
4 bytes (uint32) - number of colors in palette
4 bytes (uint32) - number of important colors  // 0=all colors 
                                               // ignored in most cases

// bit masks (optional)   
x bytes - extra bit masks   // occurs only for "3" and "6" 
                            // bitfields compression types

// color table / palette (optional)
x bytes - palette data

// pixel array
x bytes - image data

MultiEx BMS Script

Not written yet.

Notes and Comments

Generic Bitmap *.bmp Image.

Games

List of games using this file format:

Compatible Programs