@huh-david/bmp-js 0.3.0 → 0.4.1

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 CHANGED
@@ -2,11 +2,19 @@
2
2
 
3
3
  A pure TypeScript BMP encoder/decoder for Node.js.
4
4
 
5
+ ## Maintenance
6
+
7
+ This fork is actively maintained and tracks unresolved upstream `shaozilee/bmp-js` issues and PRs.
8
+
9
+ - Repository: https://github.com/Huh-David/bmp-js
10
+ - Latest release: https://github.com/Huh-David/bmp-js/releases/tag/v0.4.0
11
+
5
12
  ## Features
6
13
 
7
14
  - Decoding for BMP bit depths: 1, 4, 8, 15, 16, 24, 32
8
15
  - Decoding support for RLE-4 and RLE-8 compressed BMPs
9
- - Encoding output as 24-bit BMP
16
+ - Robust DIB handling for CORE/INFO/V4/V5 headers
17
+ - Encoding output as 24-bit BMP with configurable orientation
10
18
  - Dual package output: ESM + CommonJS
11
19
  - First-class TypeScript types
12
20
 
@@ -36,6 +44,24 @@ const encoded = encode({
36
44
  writeFileSync("./roundtrip.bmp", encoded.data);
37
45
  ```
38
46
 
47
+ ### Encode options
48
+
49
+ ```ts
50
+ import { encode } from "@huh-david/bmp-js";
51
+
52
+ const encoded = encode(
53
+ {
54
+ data: rgbaLikeBytes,
55
+ width: 320,
56
+ height: 200,
57
+ },
58
+ {
59
+ orientation: "bottom-up", // default: "top-down"
60
+ bitPP: 24, // only 24 is currently supported
61
+ },
62
+ );
63
+ ```
64
+
39
65
  ### CommonJS
40
66
 
41
67
  ```js
@@ -48,19 +74,33 @@ const encoded = bmp.encode(decoded);
48
74
  fs.writeFileSync("./roundtrip.bmp", encoded.data);
49
75
  ```
50
76
 
77
+ ### Decode options
78
+
79
+ ```ts
80
+ import { decode } from "@huh-david/bmp-js";
81
+
82
+ const decoded = decode(inputBytes, {
83
+ toRGBA: true, // return RGBA instead of default ABGR
84
+ });
85
+ ```
86
+
51
87
  ## Data layout
52
88
 
53
- Decoded pixel data is a byte buffer in `ABGR` order.
89
+ Decoded pixel data is a byte buffer in `ABGR` order by default.
90
+ If `toRGBA: true` is provided to `decode`, output is returned in `RGBA`.
54
91
 
55
92
  - `A`: alpha
56
93
  - `B`: blue
57
94
  - `G`: green
58
95
  - `R`: red
59
96
 
97
+ Input/output binary types use `Uint8Array` (Node `Buffer` is fully compatible because it extends `Uint8Array`).
98
+
60
99
  ## Development
61
100
 
62
101
  ```bash
63
102
  pnpm install
103
+ pnpm fixtures:generate
64
104
  pnpm check
65
105
  ```
66
106