# Windows Bitmap File Format

# Windows Bitmap File Format

Windows bitmap files are stored in a device-independent bitmap (DIB) format that allows Windows to display the bitmap on any type of display device. The term "device independent" means that the bitmap specifies pixel color in a form independent of the method used by a display to represent color. Bitmaps can store 1, 4 and 8 bit indexed images and 16, 24 and 32 RGB images. 4 and 8 bit images can also be compressed with RLE. Imaging can also read OS/2 bitmaps but can not save them.

## Windows Bitmap File Format Support

Format | TImageFormat equivalent | Loading | Saving
--- | --- | --- | ---
1 bit indexed | ifIndex8 | Yes | No
4 bit indexed | ifIndex8 | Yes | No
8 bit indexed | ifIndex8 | Yes | Yes
4 bit indexed RLE compressed | ifIndex8 | Yes | No
8 bit indexed RLE compressed | ifIndex8 | Yes | Yes
16 bit 555 RGB | ifX1R5G5B5 | Yes | Yes
16 bit 565 RGB (note 1) | ifR5G6B5 | Yes | Yes
16 bit 444 RGB (note 1) | ifX4R4G4B4 | Yes | Yes
24 bit RGB | ifR8G8B8 | Yes | Yes
32 bit RGB | ifX8R8G8B8 | Yes | Yes
16 bit 1555 ARGB (note 2) | ifA1R5G5B5 | Yes | Yes
16 bit 4444 ARGB (note 2) | ifA4R4G4B4 | Yes | Yes
32 bit ARGB (note 2) | ifA8R8G8B8 | Yes | Yes

1) Many image viewers and image editing programs do not support these 16 bit formats and treat them as X1R5G5B5 format.
2) Alpha channels in BMP files are often ignored by some (many) viewers/editors.

When working with Bitmap files you can find useful some options which can be set by SetOption function and their current values can be get by GetOption function. Or you can set them by modifying properties of TBitmapFileFormat class.

## Options Related to Bitmap Files

OptionId | Allowed Values | Usage
--- | --- | ---
ImagingBitmapRLE | 0 (false) or 1 (true) | Indicates whether 8 bit Bitmap images will be saved with or without RLE compression (efficient only for images with large areas of the same color). Default value is 1 (true).