0.1.3 • Published 2 years ago

@cwasm/nsbmp v0.1.3

Weekly downloads
372
License
MIT
Repository
github
Last release
2 years ago

BMP

BMP decoding for Node.js, using Libnsbmp compiled to WebAssembly.

Installation

npm install --save @cwasm/nsbmp

Usage

const fs = require('fs')
const nsbmp = require('@cwasm/nsbmp')

const source = fs.readFileSync('image.bmp')
const image = nsbmp.decode(source)

console.log(image)
// { width: 128,
//   height: 128,
//   data:
//    Uint8ClampedArray [ ... ] }

API

decode(source)

  • source (Uint8Array, required) - The BMP data
  • returns ImageData - Decoded width, height and pixel data