bmp
Mojo module 🡭
bmp
Read and write uncompressed BMP files.
BMP previews natively in most editors and OS file browsers, and encodes with nothing but stdlib byte I/O.
write_bmp emits 24-bit BGR, bottom-up, rows padded to a 4-byte
boundary. read_bmp accepts 24-bit and 32-bit uncompressed (BI_RGB)
files in either row order. Compressed variants (RLE4/RLE8), palettized
depths (1/4/8-bit) and the BI_BITFIELDS channel-mask forms raise rather
than misreading pixels.
read_bmp always returns opaque pixels: 24-bit BMP has no alpha, and a
32-bit file’s fourth byte is often padding, so a file that leaves it
zero would decode as fully transparent if it were trusted. Use PNG for
real transparency.