@huh-david/bmp-js 0.3.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/decoder.ts","../src/encoder.ts"],"sourcesContent":["import { decode } from \"./decoder\";\nimport { encode } from \"./encoder\";\n\nexport type { BmpImageData, BmpPaletteColor, DecodedBmp, EncodedBmp } from \"./types\";\nexport { BmpDecoder } from \"./decoder\";\nexport { BmpEncoder } from \"./encoder\";\nexport { encode, decode };\n\nconst bmp = {\n encode,\n decode,\n};\n\nexport default bmp;\n","import type { BmpPaletteColor, DecodedBmp } from \"./types\";\n\nclass BmpDecoder implements DecodedBmp {\n private pos = 0;\n private readonly buffer: Buffer;\n private readonly isWithAlpha: boolean;\n private bottomUp = true;\n\n private maskRed = 0;\n private maskGreen = 0;\n private maskBlue = 0;\n private mask0 = 0;\n\n fileSize!: number;\n reserved!: number;\n offset!: number;\n headerSize!: number;\n width!: number;\n height!: number;\n planes!: number;\n bitPP!: number;\n compress!: number;\n rawSize!: number;\n hr!: number;\n vr!: number;\n colors!: number;\n importantColors!: number;\n palette?: BmpPaletteColor[];\n data!: Buffer;\n\n constructor(buffer: Buffer, isWithAlpha = false) {\n this.buffer = buffer;\n this.isWithAlpha = isWithAlpha;\n\n const flag = this.buffer.toString(\"utf-8\", 0, (this.pos += 2));\n if (flag !== \"BM\") {\n throw new Error(\"Invalid BMP File\");\n }\n\n this.parseHeader();\n this.parseRGBA();\n }\n\n private parseHeader(): void {\n this.fileSize = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.reserved = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.offset = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.headerSize = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.width = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.height = this.buffer.readInt32LE(this.pos);\n this.pos += 4;\n this.planes = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n this.bitPP = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n this.compress = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.rawSize = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.hr = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.vr = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.colors = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.importantColors = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n\n if (this.bitPP === 16 && this.isWithAlpha) {\n this.bitPP = 15;\n }\n\n if (this.bitPP < 15) {\n const len = this.colors === 0 ? 1 << this.bitPP : this.colors;\n this.palette = new Array(len);\n for (let i = 0; i < len; i += 1) {\n const blue = this.buffer.readUInt8(this.pos++);\n const green = this.buffer.readUInt8(this.pos++);\n const red = this.buffer.readUInt8(this.pos++);\n const quad = this.buffer.readUInt8(this.pos++);\n this.palette[i] = { red, green, blue, quad };\n }\n }\n\n if (this.height < 0) {\n this.height *= -1;\n this.bottomUp = false;\n }\n }\n\n private parseRGBA(): void {\n const len = this.width * this.height * 4;\n this.data = Buffer.alloc(len);\n\n switch (this.bitPP) {\n case 1:\n this.bit1();\n return;\n case 4:\n this.bit4();\n return;\n case 8:\n this.bit8();\n return;\n case 15:\n this.bit15();\n return;\n case 16:\n this.bit16();\n return;\n case 24:\n this.bit24();\n return;\n case 32:\n this.bit32();\n return;\n default:\n throw new Error(`Unsupported BMP bit depth: ${this.bitPP}`);\n }\n }\n\n private getPaletteColor(index: number): BmpPaletteColor {\n const color = this.palette?.[index];\n if (color) {\n return color;\n }\n\n return {\n red: 0xff,\n green: 0xff,\n blue: 0xff,\n quad: 0x00,\n };\n }\n\n private bit1(): void {\n const xLen = Math.ceil(this.width / 8);\n const mode = xLen % 4;\n\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < xLen; x += 1) {\n const b = this.buffer.readUInt8(this.pos++);\n const location = line * this.width * 4 + x * 8 * 4;\n\n for (let i = 0; i < 8; i += 1) {\n if (x * 8 + i >= this.width) {\n break;\n }\n\n const rgb = this.getPaletteColor((b >> (7 - i)) & 0x1);\n this.data[location + i * 4] = 0;\n this.data[location + i * 4 + 1] = rgb.blue;\n this.data[location + i * 4 + 2] = rgb.green;\n this.data[location + i * 4 + 3] = rgb.red;\n }\n }\n\n if (mode !== 0) {\n this.pos += 4 - mode;\n }\n }\n }\n\n private bit4(): void {\n if (this.compress === 2) {\n this.data.fill(0xff);\n\n let location = 0;\n let lines = this.bottomUp ? this.height - 1 : 0;\n let lowNibble = false;\n\n while (location < this.data.length) {\n const a = this.buffer.readUInt8(this.pos++);\n const b = this.buffer.readUInt8(this.pos++);\n\n if (a === 0) {\n if (b === 0) {\n lines += this.bottomUp ? -1 : 1;\n location = lines * this.width * 4;\n lowNibble = false;\n continue;\n }\n\n if (b === 1) {\n break;\n }\n\n if (b === 2) {\n const x = this.buffer.readUInt8(this.pos++);\n const y = this.buffer.readUInt8(this.pos++);\n lines += this.bottomUp ? -y : y;\n location += y * this.width * 4 + x * 4;\n continue;\n }\n\n let c = this.buffer.readUInt8(this.pos++);\n for (let i = 0; i < b; i += 1) {\n if (lowNibble) {\n setPixelData.call(this, c & 0x0f);\n } else {\n setPixelData.call(this, (c & 0xf0) >> 4);\n }\n\n if ((i & 1) === 1 && i + 1 < b) {\n c = this.buffer.readUInt8(this.pos++);\n }\n\n lowNibble = !lowNibble;\n }\n\n if ((((b + 1) >> 1) & 1) === 1) {\n this.pos += 1;\n }\n } else {\n for (let i = 0; i < a; i += 1) {\n if (lowNibble) {\n setPixelData.call(this, b & 0x0f);\n } else {\n setPixelData.call(this, (b & 0xf0) >> 4);\n }\n lowNibble = !lowNibble;\n }\n }\n }\n\n function setPixelData(this: BmpDecoder, rgbIndex: number): void {\n const rgb = this.getPaletteColor(rgbIndex);\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n location += 4;\n }\n return;\n }\n\n const xLen = Math.ceil(this.width / 2);\n const mode = xLen % 4;\n\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < xLen; x += 1) {\n const b = this.buffer.readUInt8(this.pos++);\n const location = line * this.width * 4 + x * 2 * 4;\n\n const before = b >> 4;\n const after = b & 0x0f;\n\n let rgb = this.getPaletteColor(before);\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n\n if (x * 2 + 1 >= this.width) {\n break;\n }\n\n rgb = this.getPaletteColor(after);\n this.data[location + 4] = 0;\n this.data[location + 5] = rgb.blue;\n this.data[location + 6] = rgb.green;\n this.data[location + 7] = rgb.red;\n }\n\n if (mode !== 0) {\n this.pos += 4 - mode;\n }\n }\n }\n\n private bit8(): void {\n if (this.compress === 1) {\n this.data.fill(0xff);\n\n let location = 0;\n let lines = this.bottomUp ? this.height - 1 : 0;\n\n while (location < this.data.length) {\n const a = this.buffer.readUInt8(this.pos++);\n const b = this.buffer.readUInt8(this.pos++);\n\n if (a === 0) {\n if (b === 0) {\n lines += this.bottomUp ? -1 : 1;\n location = lines * this.width * 4;\n continue;\n }\n\n if (b === 1) {\n break;\n }\n\n if (b === 2) {\n const x = this.buffer.readUInt8(this.pos++);\n const y = this.buffer.readUInt8(this.pos++);\n lines += this.bottomUp ? -y : y;\n location += y * this.width * 4 + x * 4;\n continue;\n }\n\n for (let i = 0; i < b; i += 1) {\n const c = this.buffer.readUInt8(this.pos++);\n setPixelData.call(this, c);\n }\n\n if ((b & 1) === 1) {\n this.pos += 1;\n }\n } else {\n for (let i = 0; i < a; i += 1) {\n setPixelData.call(this, b);\n }\n }\n }\n\n function setPixelData(this: BmpDecoder, rgbIndex: number): void {\n const rgb = this.getPaletteColor(rgbIndex);\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n location += 4;\n }\n return;\n }\n\n const mode = this.width % 4;\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < this.width; x += 1) {\n const b = this.buffer.readUInt8(this.pos++);\n const location = line * this.width * 4 + x * 4;\n\n const rgb = this.getPaletteColor(b);\n this.data[location] = 0;\n this.data[location + 1] = rgb.blue;\n this.data[location + 2] = rgb.green;\n this.data[location + 3] = rgb.red;\n }\n\n if (mode !== 0) {\n this.pos += 4 - mode;\n }\n }\n }\n\n private bit15(): void {\n const difW = this.width % 3;\n const m = 0b11111;\n\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < this.width; x += 1) {\n const value = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n\n const blue = ((value & m) / m) * 255;\n const green = (((value >> 5) & m) / m) * 255;\n const red = (((value >> 10) & m) / m) * 255;\n const alpha = value >> 15 !== 0 ? 0xff : 0x00;\n\n const location = line * this.width * 4 + x * 4;\n this.data[location] = alpha;\n this.data[location + 1] = blue | 0;\n this.data[location + 2] = green | 0;\n this.data[location + 3] = red | 0;\n }\n\n this.pos += difW;\n }\n }\n\n private bit16(): void {\n const difW = (this.width % 2) * 2;\n this.maskRed = 0x7c00;\n this.maskGreen = 0x03e0;\n this.maskBlue = 0x001f;\n this.mask0 = 0;\n\n if (this.compress === 3) {\n this.maskRed = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.maskGreen = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.maskBlue = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.mask0 = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n }\n\n const ns: [number, number, number] = [0, 0, 0];\n for (let i = 0; i < 16; i += 1) {\n if (((this.maskRed >> i) & 0x01) !== 0) ns[0] += 1;\n if (((this.maskGreen >> i) & 0x01) !== 0) ns[1] += 1;\n if (((this.maskBlue >> i) & 0x01) !== 0) ns[2] += 1;\n }\n\n ns[1] += ns[0];\n ns[2] += ns[1];\n ns[0] = 8 - ns[0];\n ns[1] -= 8;\n ns[2] -= 8;\n\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < this.width; x += 1) {\n const value = this.buffer.readUInt16LE(this.pos);\n this.pos += 2;\n\n const blue = (value & this.maskBlue) << ns[0];\n const green = (value & this.maskGreen) >> ns[1];\n const red = (value & this.maskRed) >> ns[2];\n\n const location = line * this.width * 4 + x * 4;\n this.data[location] = 0;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n\n this.pos += difW;\n }\n }\n\n private bit24(): void {\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < this.width; x += 1) {\n const blue = this.buffer.readUInt8(this.pos++);\n const green = this.buffer.readUInt8(this.pos++);\n const red = this.buffer.readUInt8(this.pos++);\n const location = line * this.width * 4 + x * 4;\n this.data[location] = 0;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n\n this.pos += this.width % 4;\n }\n }\n\n private bit32(): void {\n if (this.compress === 3) {\n this.maskRed = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.maskGreen = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.maskBlue = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n this.mask0 = this.buffer.readUInt32LE(this.pos);\n this.pos += 4;\n\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < this.width; x += 1) {\n const alpha = this.buffer.readUInt8(this.pos++);\n const blue = this.buffer.readUInt8(this.pos++);\n const green = this.buffer.readUInt8(this.pos++);\n const red = this.buffer.readUInt8(this.pos++);\n const location = line * this.width * 4 + x * 4;\n this.data[location] = alpha;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n }\n\n return;\n }\n\n for (let y = this.height - 1; y >= 0; y -= 1) {\n const line = this.bottomUp ? y : this.height - 1 - y;\n for (let x = 0; x < this.width; x += 1) {\n const blue = this.buffer.readUInt8(this.pos++);\n const green = this.buffer.readUInt8(this.pos++);\n const red = this.buffer.readUInt8(this.pos++);\n const alpha = this.buffer.readUInt8(this.pos++);\n const location = line * this.width * 4 + x * 4;\n this.data[location] = alpha;\n this.data[location + 1] = blue;\n this.data[location + 2] = green;\n this.data[location + 3] = red;\n }\n }\n }\n\n getData(): Buffer {\n return this.data;\n }\n}\n\nexport function decode(bmpData: Buffer): DecodedBmp {\n return new BmpDecoder(bmpData);\n}\n\nexport { BmpDecoder };\n","import type { BmpImageData, EncodedBmp } from \"./types\";\n\nclass BmpEncoder {\n private readonly buffer: Buffer;\n private readonly width: number;\n private readonly height: number;\n private readonly extraBytes: number;\n private readonly rgbSize: number;\n private readonly headerInfoSize: number;\n\n private readonly flag = \"BM\";\n private readonly reserved = 0;\n private readonly offset = 54;\n private readonly fileSize: number;\n private readonly planes = 1;\n private readonly bitPP = 24;\n private readonly compress = 0;\n private readonly hr = 0;\n private readonly vr = 0;\n private readonly colors = 0;\n private readonly importantColors = 0;\n\n private pos = 0;\n\n constructor(imgData: BmpImageData) {\n this.buffer = imgData.data;\n this.width = imgData.width;\n this.height = imgData.height;\n this.extraBytes = this.width % 4;\n this.rgbSize = this.height * (3 * this.width + this.extraBytes);\n this.headerInfoSize = 40;\n this.fileSize = this.rgbSize + this.offset;\n }\n\n encode(): Buffer {\n const tempBuffer = Buffer.alloc(this.offset + this.rgbSize);\n\n tempBuffer.write(this.flag, this.pos, 2);\n this.pos += 2;\n tempBuffer.writeUInt32LE(this.fileSize, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.reserved, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.offset, this.pos);\n this.pos += 4;\n\n tempBuffer.writeUInt32LE(this.headerInfoSize, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.width, this.pos);\n this.pos += 4;\n tempBuffer.writeInt32LE(-this.height, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt16LE(this.planes, this.pos);\n this.pos += 2;\n tempBuffer.writeUInt16LE(this.bitPP, this.pos);\n this.pos += 2;\n tempBuffer.writeUInt32LE(this.compress, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.rgbSize, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.hr, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.vr, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.colors, this.pos);\n this.pos += 4;\n tempBuffer.writeUInt32LE(this.importantColors, this.pos);\n this.pos += 4;\n\n let i = 0;\n const rowBytes = 3 * this.width + this.extraBytes;\n\n for (let y = 0; y < this.height; y += 1) {\n for (let x = 0; x < this.width; x += 1) {\n const p = this.pos + y * rowBytes + x * 3;\n i += 1; // skip alpha from ABGR\n tempBuffer[p] = this.buffer.readUInt8(i++); // blue\n tempBuffer[p + 1] = this.buffer.readUInt8(i++); // green\n tempBuffer[p + 2] = this.buffer.readUInt8(i++); // red\n }\n\n if (this.extraBytes > 0) {\n const fillOffset = this.pos + y * rowBytes + this.width * 3;\n tempBuffer.fill(0, fillOffset, fillOffset + this.extraBytes);\n }\n }\n\n return tempBuffer;\n }\n}\n\nexport function encode(imgData: BmpImageData, quality = 100): EncodedBmp {\n void quality;\n const encoder = new BmpEncoder(imgData);\n const data = encoder.encode();\n\n return {\n data,\n width: imgData.width,\n height: imgData.height,\n };\n}\n\nexport { BmpEncoder };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,aAAN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,WAAW,KAAK,QAAQ;AAC1D,mBAAW,KAAK,GAAG,YAAY,aAAa,KAAK,UAAU;AAAA,MAC7D;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AACF;AAEO,SAAS,OAAO,SAAuB,UAAU,KAAiB;AACvE,OAAK;AACL,QAAM,UAAU,IAAI,WAAW,OAAO;AACtC,QAAM,OAAO,QAAQ,OAAO;AAE5B,SAAO;AAAA,IACL;AAAA,IACA,OAAO,QAAQ;AAAA,IACf,QAAQ,QAAQ;AAAA,EAClB;AACF;;;AF7FA,IAAM,MAAM;AAAA,EACV;AAAA,EACA;AACF;AAEA,IAAO,gBAAQ;","names":["setPixelData"]}
@@ -0,0 +1,106 @@
1
+ interface BmpPaletteColor {
2
+ red: number;
3
+ green: number;
4
+ blue: number;
5
+ quad: number;
6
+ }
7
+ interface BmpImageData {
8
+ data: Buffer;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ interface EncodedBmp {
13
+ data: Buffer;
14
+ width: number;
15
+ height: number;
16
+ }
17
+ interface DecodedBmp {
18
+ fileSize: number;
19
+ reserved: number;
20
+ offset: number;
21
+ headerSize: number;
22
+ width: number;
23
+ height: number;
24
+ planes: number;
25
+ bitPP: number;
26
+ compress: number;
27
+ rawSize: number;
28
+ hr: number;
29
+ vr: number;
30
+ colors: number;
31
+ importantColors: number;
32
+ palette?: BmpPaletteColor[];
33
+ data: Buffer;
34
+ getData(): Buffer;
35
+ }
36
+
37
+ declare class BmpDecoder implements DecodedBmp {
38
+ private pos;
39
+ private readonly buffer;
40
+ private readonly isWithAlpha;
41
+ private bottomUp;
42
+ private maskRed;
43
+ private maskGreen;
44
+ private maskBlue;
45
+ private mask0;
46
+ fileSize: number;
47
+ reserved: number;
48
+ offset: number;
49
+ headerSize: number;
50
+ width: number;
51
+ height: number;
52
+ planes: number;
53
+ bitPP: number;
54
+ compress: number;
55
+ rawSize: number;
56
+ hr: number;
57
+ vr: number;
58
+ colors: number;
59
+ importantColors: number;
60
+ palette?: BmpPaletteColor[];
61
+ data: Buffer;
62
+ constructor(buffer: Buffer, isWithAlpha?: boolean);
63
+ private parseHeader;
64
+ private parseRGBA;
65
+ private getPaletteColor;
66
+ private bit1;
67
+ private bit4;
68
+ private bit8;
69
+ private bit15;
70
+ private bit16;
71
+ private bit24;
72
+ private bit32;
73
+ getData(): Buffer;
74
+ }
75
+ declare function decode(bmpData: Buffer): DecodedBmp;
76
+
77
+ declare class BmpEncoder {
78
+ private readonly buffer;
79
+ private readonly width;
80
+ private readonly height;
81
+ private readonly extraBytes;
82
+ private readonly rgbSize;
83
+ private readonly headerInfoSize;
84
+ private readonly flag;
85
+ private readonly reserved;
86
+ private readonly offset;
87
+ private readonly fileSize;
88
+ private readonly planes;
89
+ private readonly bitPP;
90
+ private readonly compress;
91
+ private readonly hr;
92
+ private readonly vr;
93
+ private readonly colors;
94
+ private readonly importantColors;
95
+ private pos;
96
+ constructor(imgData: BmpImageData);
97
+ encode(): Buffer;
98
+ }
99
+ declare function encode(imgData: BmpImageData, quality?: number): EncodedBmp;
100
+
101
+ declare const bmp: {
102
+ encode: typeof encode;
103
+ decode: typeof decode;
104
+ };
105
+
106
+ export { BmpDecoder, BmpEncoder, type BmpImageData, type BmpPaletteColor, type DecodedBmp, type EncodedBmp, decode, bmp as default, encode };
@@ -0,0 +1,106 @@
1
+ interface BmpPaletteColor {
2
+ red: number;
3
+ green: number;
4
+ blue: number;
5
+ quad: number;
6
+ }
7
+ interface BmpImageData {
8
+ data: Buffer;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ interface EncodedBmp {
13
+ data: Buffer;
14
+ width: number;
15
+ height: number;
16
+ }
17
+ interface DecodedBmp {
18
+ fileSize: number;
19
+ reserved: number;
20
+ offset: number;
21
+ headerSize: number;
22
+ width: number;
23
+ height: number;
24
+ planes: number;
25
+ bitPP: number;
26
+ compress: number;
27
+ rawSize: number;
28
+ hr: number;
29
+ vr: number;
30
+ colors: number;
31
+ importantColors: number;
32
+ palette?: BmpPaletteColor[];
33
+ data: Buffer;
34
+ getData(): Buffer;
35
+ }
36
+
37
+ declare class BmpDecoder implements DecodedBmp {
38
+ private pos;
39
+ private readonly buffer;
40
+ private readonly isWithAlpha;
41
+ private bottomUp;
42
+ private maskRed;
43
+ private maskGreen;
44
+ private maskBlue;
45
+ private mask0;
46
+ fileSize: number;
47
+ reserved: number;
48
+ offset: number;
49
+ headerSize: number;
50
+ width: number;
51
+ height: number;
52
+ planes: number;
53
+ bitPP: number;
54
+ compress: number;
55
+ rawSize: number;
56
+ hr: number;
57
+ vr: number;
58
+ colors: number;
59
+ importantColors: number;
60
+ palette?: BmpPaletteColor[];
61
+ data: Buffer;
62
+ constructor(buffer: Buffer, isWithAlpha?: boolean);
63
+ private parseHeader;
64
+ private parseRGBA;
65
+ private getPaletteColor;
66
+ private bit1;
67
+ private bit4;
68
+ private bit8;
69
+ private bit15;
70
+ private bit16;
71
+ private bit24;
72
+ private bit32;
73
+ getData(): Buffer;
74
+ }
75
+ declare function decode(bmpData: Buffer): DecodedBmp;
76
+
77
+ declare class BmpEncoder {
78
+ private readonly buffer;
79
+ private readonly width;
80
+ private readonly height;
81
+ private readonly extraBytes;
82
+ private readonly rgbSize;
83
+ private readonly headerInfoSize;
84
+ private readonly flag;
85
+ private readonly reserved;
86
+ private readonly offset;
87
+ private readonly fileSize;
88
+ private readonly planes;
89
+ private readonly bitPP;
90
+ private readonly compress;
91
+ private readonly hr;
92
+ private readonly vr;
93
+ private readonly colors;
94
+ private readonly importantColors;
95
+ private pos;
96
+ constructor(imgData: BmpImageData);
97
+ encode(): Buffer;
98
+ }
99
+ declare function encode(imgData: BmpImageData, quality?: number): EncodedBmp;
100
+
101
+ declare const bmp: {
102
+ encode: typeof encode;
103
+ decode: typeof decode;
104
+ };
105
+
106
+ export { BmpDecoder, BmpEncoder, type BmpImageData, type BmpPaletteColor, type DecodedBmp, type EncodedBmp, decode, bmp as default, encode };