Skip to content

CaramelFur/bmp-img

Repository files navigation

bmp-img

Typescript bindings for encoding and decoding BMP images. This library uses the BMPxx c++ library.

Documentation

Encoding

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

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;
}

Enums

enum BMPChannels {
  RGB = 3,
  RGBA = 4,
}

Release notes

  • [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

About

A typescript bmp encoder and decoder with bindings to bmpxx

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published