@huh-david/bmp-js 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -1
- package/dist/index.cjs +466 -392
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -32
- package/dist/index.d.ts +46 -32
- package/dist/index.js +466 -392
- package/dist/index.js.map +1 -1
- package/package.json +20 -19
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@ A pure TypeScript BMP encoder/decoder for Node.js.
|
|
|
6
6
|
|
|
7
7
|
- Decoding for BMP bit depths: 1, 4, 8, 15, 16, 24, 32
|
|
8
8
|
- Decoding support for RLE-4 and RLE-8 compressed BMPs
|
|
9
|
-
-
|
|
9
|
+
- Robust DIB handling for CORE/INFO/V4/V5 headers
|
|
10
|
+
- Encoding output as 24-bit BMP with configurable orientation
|
|
10
11
|
- Dual package output: ESM + CommonJS
|
|
11
12
|
- First-class TypeScript types
|
|
12
13
|
|
|
@@ -36,6 +37,24 @@ const encoded = encode({
|
|
|
36
37
|
writeFileSync("./roundtrip.bmp", encoded.data);
|
|
37
38
|
```
|
|
38
39
|
|
|
40
|
+
### Encode options
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { encode } from "@huh-david/bmp-js";
|
|
44
|
+
|
|
45
|
+
const encoded = encode(
|
|
46
|
+
{
|
|
47
|
+
data: rgbaLikeBytes,
|
|
48
|
+
width: 320,
|
|
49
|
+
height: 200,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
orientation: "bottom-up", // default: "top-down"
|
|
53
|
+
bitPP: 24, // only 24 is currently supported
|
|
54
|
+
},
|
|
55
|
+
);
|
|
56
|
+
```
|
|
57
|
+
|
|
39
58
|
### CommonJS
|
|
40
59
|
|
|
41
60
|
```js
|
|
@@ -57,10 +76,13 @@ Decoded pixel data is a byte buffer in `ABGR` order.
|
|
|
57
76
|
- `G`: green
|
|
58
77
|
- `R`: red
|
|
59
78
|
|
|
79
|
+
Input/output binary types use `Uint8Array` (Node `Buffer` is fully compatible because it extends `Uint8Array`).
|
|
80
|
+
|
|
60
81
|
## Development
|
|
61
82
|
|
|
62
83
|
```bash
|
|
63
84
|
pnpm install
|
|
85
|
+
pnpm fixtures:generate
|
|
64
86
|
pnpm check
|
|
65
87
|
```
|
|
66
88
|
|