bmp-img
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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

Package Sidebar

Install

npm i bmp-img

Weekly Downloads

5

Version

1.2.2

License

GPL-3.0

Unpacked Size

66.4 kB

Total Files

12

Last publish

Collaborators

  • caramelfur