Revert "Revert "Fixed support for BMP""

This reverts commit 2418b0c967b482d0080bcf631b5e0724c7d8d854.