BMP codec implementation has several limitations

Created by: laurentes

In order to remove ImageMagick dependency, I had to introduce a BMP codec. Strangely, there are not that many open-source implementations, and I had finally decided to implement my own codec.

As BMP consists in a set of multiple formats/headers, this implementation does not support all types of BMP images. In particular, there are the following limitations:

  • Only OS2 v1 (14 bytes DIB header) and Windows v1/4/5 (40/108/124 bytes DIB header) DIB headers are supported
  • Only non-compressed BMP images are supported

Looking at the BMP samples here: http://vaxa.wvnet.edu/vmswww/bmp.html, this implies that the following images can not be read:

  • "The image below is a 4 bit compressed BMP. "
  • "The image below is a 8 bit compressed BMP. "
  • "The image below is a 4 bit OS/2 version 2 BMP. "
  • "The image below is a 32 bit 888 bitfield version 4 BMP. "
  • "The image below is a 32 bit version 5 BMP. "
  • "The image below is a 32 bit transparent version 4 BMP. " The remaining ones should be read with success.