encodeBmp

Encode bitmap as a BMP: 24-bit BI_RGB when it is opaque, or 32-bit BI_BITFIELDS under a V4 header when it carries alpha (plain 32-bit BMP alpha is officially "reserved", and half the world's readers discard it). Uncompressed and lossless either way.