npm install decode-bmpDecode .bmp images
``sh`
npm install --save decode-bmp
`js
const decodeBmp = require('decode-bmp')
const fs = require('fs')
const source = fs.readFileSync('foobar.bmp')
const image = decodeBmp(source)
console.log(image)
//=> { width: 32, height: 32, data: Uint8ClampedArray(...), colorDepth: 32 }
`
Decodes the .bmp file in the given buffer, and returns an image.
The image has the following properties:
- width: number - The width of the image, in pixelsheight: number
- - The height of the image, in pixelsdata: Uint8ClampedArray
- - The data of the image, in the RGBA formatcolorDepth: number` - The color depth of the image as the number of bits used per pixel
-