Typescript bindings for encoding and decoding BMP images. This library uses the BMPxx c++ library.
You can encode a BMP image with the BMPencode
function.
The input pixels are ordered as either RGB
or RGBA
, depending on what you specify in the channels parameter.
function BMPencode(
pixels: Buffer,
options: {
width: number;
height: number;
channels: BMPChannels;
},
) => Buffer
Decoding is just as easy. You can decode an image by using the BMPdecode
function.
The output pixels are ordered as either RGB
or RGBA
, depending on the channels value.
function BMPdecode(data: Buffer) => {
pixels: Buffer;
width: number;
height: number;
channels: BMPChannels;
}
enum BMPChannels {
RGB = 3,
RGBA = 4,
}
- [v1.2.2]
- Fix build for MacOS and Windows
- [v1.2.0]
- Update dependencies
- Remove building with
-march=native
- [v1.1.0]
- Update BMPxx
- [v1.0.0]
- Initial release