Imagesharp: Bitmap DIB Header formats

Created on 31 Aug 2017  Âˇ  6Comments  Âˇ  Source: SixLabors/ImageSharp

We currently support BITMAPCOREHEADER & BITMAPINFOHEADER should add support for loading metadata from the other formats

Our current support matrix:

Supported | Size | Header name | OS support | Features | Written by
-- | -- | -- | -- | -- | --
✔️ | 12 | BITMAPCOREHEADER/OS21XBITMAPHEADER | Windows 2.0 or laterOS/2 1.x[2] |   |  
❎ | 64 | OS22XBITMAPHEADER | OS/2 BITMAPCOREHEADER2 | Adds halftoning. Adds RLE and Huffman 1D compression. |  
✔️ | 16 | OS22XBITMAPHEADER | This variant of the previous header contains only the first 16 bytes and the remaining bytes are assumed to be zero values.[2]An example of such a case is the graphic pal8os2v2-16.bmp[9] of the BMP Suite.[10] |   |  
✔️ | 40 | BITMAPINFOHEADER | Windows NT, 3.1x or later[1] | Adds 16 bpp and 32 bpp formats. Adds RLE compression. |  
✔️ | 52 | BITMAPV2INFOHEADER | Undocumented | Adds RGB bit masks. | Adobe Photoshop
✔️ | 56 | BITMAPV3INFOHEADER | Not officially documented, but this documentation was posted on Adobe's forums, by an employee of Adobe with a statement that the standard was at one point in the past included in official MS documentation [11] | Adds alpha channel bit mask. | Adobe Photoshop
❎ | 108 | BITMAPV4HEADER | Windows NT 4.0, 95 or later | Adds color space type and gamma correction |  
❎ | 124 | BITMAPV5HEADER | Windows NT 5.0, 98 or later | Adds ICC color profiles

✔️ : Currently supported
❎ : Partial support (we read the BITMAPINFOHEADER fields but ignore the rest)
❌ : Not currently supported

https://en.wikipedia.org/wiki/BMP_file_format#DIB_header_.28bitmap_information_header.29

bmp up-for-grabs

All 6 comments

@tocsoft: Bitmap header with 52 bytes and with 56 bytes are now fully supported. Both are special adobe bitmap headers which contain the color masks.

@brianpopow I've updated the table. Thanks for your effort!

@JimBobSquarePants: actually OS22XBITMAPHEADER headers are partially supported. The compression types RLE4, RLE8 and uncompressed are supported. RLE24 and 1D Huffman is not supported.

I think this issue can be closed. We support all relevant bitmap variants now.

There are some exotic variants we do not support, like BMP files with embedded JPEG and PNG images (which are for printers). Or some OS/2 icon bitmap variants. It would be just a solely academic exercise to add support for those, as i really doubt that those can be found in the wild.

Sounds good to me @brianpopow 👍

Was this page helpful?
0 / 5 - 0 ratings