# @vingle/bmp-js

> A pure javascript BMP encoder and decoder

Latest version **0.2.5** (published 2018-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vingle/bmp-js
pnpm add @vingle/bmp-js
yarn add @vingle/bmp-js
bun add @vingle/bmp-js
```

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2018-09-04 |
| First published | 2018-09-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 91 |
| Author | shaozilee |
| Maintainers | aprilrd, dayzen, kurtlee, mooyoul, satune, sejung.kwon, vingle-bot |
| Keywords | bmp, 1bit, 4bit, 8bit, 16bit, 24bit, 32bit, encoder, decoder, image, javascript, js |

## Links

- npm: https://www.npmjs.com/package/@vingle/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/@vingle/bmp-js

## Dependencies (1)

- [@types/node](https://npm.io/package/@types/node.md) ^8.10.29

## 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.2.5 (latest) — 2018-09-04
- 0.2.4 — 2018-09-04
- 0.2.3 — 2018-09-04
- 0.2.2 — 2018-09-04
- 0.2.1 — 2018-09-04
- 0.2.0 — 2018-09-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, including:

1. fileSize
2. reserved
3. offset
4. headerSize
5. width
6. height
7. planes
8. bitPP
9. compress
10. rawSize
11. hr
12. vr
13. colors
14. importantColors
15. palette
16. data
    a. This is a byte array
    b. The bytes are ordered as follows: ABGR (alpha, blue, green, red)
    c. 4 bytes represent 1 pixel

### Encode RGB

```js
var bmp = require("bmp-js");
var fs = require("fs");
var bmpData = {
    data, //Buffer
    width, //Number
    height //Number
};
var rawData = bmp.encode(bmpData); //defaults to no compression
fs.WriteFileSync('./image.bmp', rawData.data);
```

### License

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

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