# bmp-js

> A pure javascript BMP encoder and decoder

Latest version **0.1.0** (published 2018-04-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install bmp-js
pnpm add bmp-js
yarn add bmp-js
bun add bmp-js
```

## Health

**Score 18/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-04-23 |
| First published | 2014-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/bmp-js) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 630.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 91 |
| Author | shaozilee |
| Maintainers | shaozilee |
| Keywords | bmp, 1bit, 4bit, 8bit, 16bit, 24bit, 32bit, encoder, decoder, image, javascript, js |

## Links

- npm: https://www.npmjs.com/package/bmp-js
- Repository: https://github.com/shaozilee/bmp-js
- Homepage: https://github.com/shaozilee/bmp-js#readme
- Issues: https://github.com/shaozilee/bmp-js/issues
- npm.io page: https://npm.io/package/bmp-js

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.0 (latest) — 2018-04-23
- 0.0.3 — 2016-11-22
- 0.0.2 — 2016-08-26
- 0.0.1 — 2014-08-04

## README

bmp-js
======

A pure javascript Bmp encoder and decoder for node.js

Supports all bits decoding(1,4,8,16,24,32) and encoding with 24bit.

##Install

	$ npm install bmp-js


How to use?
---
###Decode BMP
```js
var bmp = require("bmp-js");
var bmpBuffer = fs.readFileSync('bit24.bmp');
var bmpData = bmp.decode(bmpBuffer);

```

`bmpData` has all properties includes:

1. fileSize,reserved,offset

2. headerSize,width,height,planes,bitPP,compress,rawSize,hr,vr,colors,importantColors

3. palette

4. data-------byte array order by ABGR ABGR ABGR,4 bytes per pixel


###Encode RGB
```js
var bmp = require("bmp-js");
//bmpData={data:Buffer,width:Number,height:Height}
var rawData = bmp.encode(bmpData);//default no compression,write rawData to .bmp file

```

License
---
U can use on free with [MIT License](https://github.com/shaozilee/bmp-js/blob/master/LICENSE)

---
_Source: https://npm.io/package/bmp-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
