If you appreciate the work done within the wiki, please consider supporting The Cutting Room Floor on Patreon. Thanks for all your support!
🎄 Merry Christmas, TCRF! 🎄
🎄 Merry Christmas, TCRF! 🎄
Format:BMP
Jump to navigation
Jump to search
The BMP, or Bitmap Format, is a file format created by Microsoft in the early 1990s. The file is split into 3 chunks - the usual File Header chunk, the optional Palette Chunk, and the required bitmap chunk.
Contents
Header
A file header stores information about files, in this case the Image Size. Below is easy-to-read code made in QBasic and a translated version of how the code would be in human readable form when loading a 256-Colo(u)r (8BPP) file.
QB Code | Human Readable Form |
---|---|
TYPE BMPHeaderType id AS STRING * 2 'Should be "BM" size AS LONG 'Size of the data rr1 AS INTEGER ' rr2 AS INTEGER ' offset AS LONG 'Position of start of pixel data horz AS LONG ' wid AS LONG 'Image width hei AS LONG 'Image height planes AS INTEGER ' bpp AS INTEGER 'Should read 8 for a 256 colo(u)r image pakbyte AS LONG ' imagebytes AS LONG 'Width*Height xres AS LONG ' yres AS LONG ' colch AS LONG ' ic AS LONG ' pal AS STRING * 1024 'The Palette END TYPE |
id = 2 bytes - in ASCII "BM" size = 4 bytes containing the size of the data. rr1 = 2 bytes, not important when loading. rr2 = 2 bytes, not important when loading. offset = 4 bytes, offset of start of image data. horz = 4 bytes, not important. wid = 4 bytes, Image Width hei = 4 bytes, Image Height planes = Bit Planes, 2 bytes bpp = 2 bytes, see below for values. pakbyte = 4 bytes, determines if the file is compressed. imagebytes = 4 bytes, Width*Height xres = 4 bytes yres = 4 bytes colch = 4 bytes ic = 4 bytes pal = 1024 bytes, see below for format style. |
The Palette (Can Be Stored in ".PAL")
Determining BPP and Palette Byte Size
BPP | Colo(u)r Count |
---|---|
1 | 2 |
2 | 4 |
4 | 16 |
8 | 256 |
Data Structure
Being padded by 4 bytes, it would be stored as BGR (Blue, Green, Red).
Bitmap Structure
The image is stored upside-down and each scanline is padded by 4 bytes. For more detailed specification, see the Bitmap File Specification.
Audio Formats | |
---|---|
Nintendo DS | Nitro Sound Container/SDAT (SSEQ, STRM) • Digital Sound Elements (SMDL) |
Game Boy Advance | M4A/Sappy Sound Engine • Krawall |
PlayStation 2 | Digital Sound Elements |
Wii | Digital Sound Elements |
Various | BWSB Sound Format |
Graphic Formats | |
Various | GIF |
Windows | BMP • DDS |
Executable Formats (OS-specific) | |
DOS | Command |
Windows | Portable Executable |
Executable Formats (Game-specific) | |
Deus Ex | CON |