@thi.ng/pixel-io-netpbm 2.1.7 → 2.1.10
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/CHANGELOG.md +7 -1
- package/README.md +1 -1
- package/package.json +12 -12
- package/read.d.ts +21 -21
- package/read.js +22 -22
- package/write.d.ts +8 -8
- package/write.js +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**:
|
|
3
|
+
- **Last updated**: 2022-04-07T14:17:30Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [2.1.9](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-io-netpbm@2.1.9) (2022-04-07)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- replace deprecated .substr() w/ .substring() ([0710509](https://github.com/thi-ng/umbrella/commit/0710509))
|
|
17
|
+
|
|
12
18
|
## [2.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-io-netpbm@2.1.0) (2021-11-17)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/pixel-io-netpbm",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.10",
|
|
4
4
|
"description": "Multi-format NetPBM reader & writer support for @thi.ng/pixel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.3.
|
|
38
|
-
"@thi.ng/errors": "^2.1.
|
|
39
|
-
"@thi.ng/pixel": "^3.
|
|
37
|
+
"@thi.ng/api": "^8.3.5",
|
|
38
|
+
"@thi.ng/errors": "^2.1.5",
|
|
39
|
+
"@thi.ng/pixel": "^3.4.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@microsoft/api-extractor": "^7.19.
|
|
43
|
-
"@thi.ng/testament": "^0.2.
|
|
42
|
+
"@microsoft/api-extractor": "^7.19.4",
|
|
43
|
+
"@thi.ng/testament": "^0.2.5",
|
|
44
44
|
"rimraf": "^3.0.2",
|
|
45
45
|
"tools": "^0.0.1",
|
|
46
|
-
"typedoc": "^0.22.
|
|
47
|
-
"typescript": "^4.
|
|
46
|
+
"typedoc": "^0.22.13",
|
|
47
|
+
"typescript": "^4.6.2"
|
|
48
48
|
},
|
|
49
49
|
"keywords": [
|
|
50
50
|
"1bit",
|
|
@@ -73,18 +73,18 @@
|
|
|
73
73
|
],
|
|
74
74
|
"exports": {
|
|
75
75
|
".": {
|
|
76
|
-
"
|
|
76
|
+
"default": "./index.js"
|
|
77
77
|
},
|
|
78
78
|
"./read": {
|
|
79
|
-
"
|
|
79
|
+
"default": "./read.js"
|
|
80
80
|
},
|
|
81
81
|
"./write": {
|
|
82
|
-
"
|
|
82
|
+
"default": "./write.js"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
85
|
"thi.ng": {
|
|
86
86
|
"parent": "@thi.ng/pixel",
|
|
87
87
|
"year": 2021
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "542bf14bd0c7a56b4e6297718189eea772a824b7\n"
|
|
90
90
|
}
|
package/read.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parses header information from given NetPBM file byte buffer.
|
|
3
3
|
*
|
|
4
|
-
* @param src
|
|
4
|
+
* @param src -
|
|
5
5
|
*/
|
|
6
6
|
export declare const parseHeader: (src: Uint8Array) => {
|
|
7
7
|
type: string;
|
|
@@ -26,7 +26,7 @@ export declare const parseHeader: (src: Uint8Array) => {
|
|
|
26
26
|
* Function will throw an error if image is of any other type or header is
|
|
27
27
|
* corrupt otherwise. Any embedded comments will be discarded.
|
|
28
28
|
*
|
|
29
|
-
* @param src
|
|
29
|
+
* @param src -
|
|
30
30
|
*/
|
|
31
31
|
export declare const read: (src: Uint8Array) => import("@thi.ng/pixel/int").IntBuffer;
|
|
32
32
|
/**
|
|
@@ -34,10 +34,10 @@ export declare const read: (src: Uint8Array) => import("@thi.ng/pixel/int").IntB
|
|
|
34
34
|
* returns {@link @thi.ng/pixel#IntBuffer} in `GRAY8` format (due to current
|
|
35
35
|
* lack of true 1bit format).
|
|
36
36
|
*
|
|
37
|
-
* @param src
|
|
38
|
-
* @param i
|
|
39
|
-
* @param width
|
|
40
|
-
* @param height
|
|
37
|
+
* @param src -
|
|
38
|
+
* @param i -
|
|
39
|
+
* @param width -
|
|
40
|
+
* @param height -
|
|
41
41
|
*/
|
|
42
42
|
export declare const readPBM: (src: Uint8Array, i: number, width: number, height: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
43
43
|
/**
|
|
@@ -49,11 +49,11 @@ export declare const readPBM: (src: Uint8Array, i: number, width: number, height
|
|
|
49
49
|
* @remarks
|
|
50
50
|
* Reference: http://netpbm.sourceforge.net/doc/pbm.html
|
|
51
51
|
*
|
|
52
|
-
* @param src
|
|
53
|
-
* @param i
|
|
54
|
-
* @param width
|
|
55
|
-
* @param height
|
|
56
|
-
* @param max
|
|
52
|
+
* @param src -
|
|
53
|
+
* @param i -
|
|
54
|
+
* @param width -
|
|
55
|
+
* @param height -
|
|
56
|
+
* @param max -
|
|
57
57
|
*/
|
|
58
58
|
export declare const readPGM8: (src: Uint8Array, i: number, width: number, height: number, max?: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
59
59
|
/**
|
|
@@ -64,11 +64,11 @@ export declare const readPGM8: (src: Uint8Array, i: number, width: number, heigh
|
|
|
64
64
|
* @remarks
|
|
65
65
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
66
66
|
*
|
|
67
|
-
* @param src
|
|
68
|
-
* @param i
|
|
69
|
-
* @param width
|
|
70
|
-
* @param height
|
|
71
|
-
* @param max
|
|
67
|
+
* @param src -
|
|
68
|
+
* @param i -
|
|
69
|
+
* @param width -
|
|
70
|
+
* @param height -
|
|
71
|
+
* @param max -
|
|
72
72
|
*/
|
|
73
73
|
export declare const readPGM16: (src: Uint8Array, i: number, width: number, height: number, max?: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
74
74
|
/**
|
|
@@ -80,11 +80,11 @@ export declare const readPGM16: (src: Uint8Array, i: number, width: number, heig
|
|
|
80
80
|
* @remarks
|
|
81
81
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
82
82
|
*
|
|
83
|
-
* @param src
|
|
84
|
-
* @param i
|
|
85
|
-
* @param width
|
|
86
|
-
* @param height
|
|
87
|
-
* @param max
|
|
83
|
+
* @param src -
|
|
84
|
+
* @param i -
|
|
85
|
+
* @param width -
|
|
86
|
+
* @param height -
|
|
87
|
+
* @param max -
|
|
88
88
|
*/
|
|
89
89
|
export declare const readPPM: (src: Uint8Array, i: number, width: number, height: number, max?: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
90
90
|
//# sourceMappingURL=read.d.ts.map
|
package/read.js
CHANGED
|
@@ -23,7 +23,7 @@ const readComments = (src, acc, i) => {
|
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
const [comment, j] = readUntil(src, i);
|
|
25
25
|
assert(j !== i, `EOF reached`);
|
|
26
|
-
acc.push(comment.
|
|
26
|
+
acc.push(comment.substring(1).trim());
|
|
27
27
|
i = j;
|
|
28
28
|
}
|
|
29
29
|
return i;
|
|
@@ -31,7 +31,7 @@ const readComments = (src, acc, i) => {
|
|
|
31
31
|
/**
|
|
32
32
|
* Parses header information from given NetPBM file byte buffer.
|
|
33
33
|
*
|
|
34
|
-
* @param src
|
|
34
|
+
* @param src -
|
|
35
35
|
*/
|
|
36
36
|
export const parseHeader = (src) => {
|
|
37
37
|
let type;
|
|
@@ -75,7 +75,7 @@ export const parseHeader = (src) => {
|
|
|
75
75
|
* Function will throw an error if image is of any other type or header is
|
|
76
76
|
* corrupt otherwise. Any embedded comments will be discarded.
|
|
77
77
|
*
|
|
78
|
-
* @param src
|
|
78
|
+
* @param src -
|
|
79
79
|
*/
|
|
80
80
|
export const read = (src) => {
|
|
81
81
|
const { type, width, height, max, start } = parseHeader(src);
|
|
@@ -97,10 +97,10 @@ export const read = (src) => {
|
|
|
97
97
|
* returns {@link @thi.ng/pixel#IntBuffer} in `GRAY8` format (due to current
|
|
98
98
|
* lack of true 1bit format).
|
|
99
99
|
*
|
|
100
|
-
* @param src
|
|
101
|
-
* @param i
|
|
102
|
-
* @param width
|
|
103
|
-
* @param height
|
|
100
|
+
* @param src -
|
|
101
|
+
* @param i -
|
|
102
|
+
* @param width -
|
|
103
|
+
* @param height -
|
|
104
104
|
*/
|
|
105
105
|
export const readPBM = (src, i, width, height) => {
|
|
106
106
|
const buf = intBuffer(width, height, GRAY8);
|
|
@@ -124,11 +124,11 @@ export const readPBM = (src, i, width, height) => {
|
|
|
124
124
|
* @remarks
|
|
125
125
|
* Reference: http://netpbm.sourceforge.net/doc/pbm.html
|
|
126
126
|
*
|
|
127
|
-
* @param src
|
|
128
|
-
* @param i
|
|
129
|
-
* @param width
|
|
130
|
-
* @param height
|
|
131
|
-
* @param max
|
|
127
|
+
* @param src -
|
|
128
|
+
* @param i -
|
|
129
|
+
* @param width -
|
|
130
|
+
* @param height -
|
|
131
|
+
* @param max -
|
|
132
132
|
*/
|
|
133
133
|
export const readPGM8 = (src, i, width, height, max = 0xff) => {
|
|
134
134
|
const buf = intBuffer(width, height, GRAY8);
|
|
@@ -152,11 +152,11 @@ export const readPGM8 = (src, i, width, height, max = 0xff) => {
|
|
|
152
152
|
* @remarks
|
|
153
153
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
154
154
|
*
|
|
155
|
-
* @param src
|
|
156
|
-
* @param i
|
|
157
|
-
* @param width
|
|
158
|
-
* @param height
|
|
159
|
-
* @param max
|
|
155
|
+
* @param src -
|
|
156
|
+
* @param i -
|
|
157
|
+
* @param width -
|
|
158
|
+
* @param height -
|
|
159
|
+
* @param max -
|
|
160
160
|
*/
|
|
161
161
|
export const readPGM16 = (src, i, width, height, max = 0xffff) => {
|
|
162
162
|
const buf = intBuffer(width, height, GRAY16);
|
|
@@ -176,11 +176,11 @@ export const readPGM16 = (src, i, width, height, max = 0xffff) => {
|
|
|
176
176
|
* @remarks
|
|
177
177
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
178
178
|
*
|
|
179
|
-
* @param src
|
|
180
|
-
* @param i
|
|
181
|
-
* @param width
|
|
182
|
-
* @param height
|
|
183
|
-
* @param max
|
|
179
|
+
* @param src -
|
|
180
|
+
* @param i -
|
|
181
|
+
* @param width -
|
|
182
|
+
* @param height -
|
|
183
|
+
* @param max -
|
|
184
184
|
*/
|
|
185
185
|
export const readPPM = (src, i, width, height, max = 0xff) => {
|
|
186
186
|
const buf = intBuffer(width, height, RGB888);
|
package/write.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ import type { IntBuffer } from "@thi.ng/pixel";
|
|
|
5
5
|
* @remarks
|
|
6
6
|
* Reference: http://netpbm.sourceforge.net/doc/pbm.html
|
|
7
7
|
*
|
|
8
|
-
* @param buf
|
|
9
|
-
* @param comments
|
|
8
|
+
* @param buf -
|
|
9
|
+
* @param comments -
|
|
10
10
|
*/
|
|
11
11
|
export declare const asPBM: (buf: IntBuffer, comments?: string[] | undefined) => Uint8Array;
|
|
12
12
|
/**
|
|
@@ -16,8 +16,8 @@ export declare const asPBM: (buf: IntBuffer, comments?: string[] | undefined) =>
|
|
|
16
16
|
* @remarks
|
|
17
17
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
18
18
|
*
|
|
19
|
-
* @param buf
|
|
20
|
-
* @param comments
|
|
19
|
+
* @param buf -
|
|
20
|
+
* @param comments -
|
|
21
21
|
*/
|
|
22
22
|
export declare const asPGM: (buf: IntBuffer, comments?: string[] | undefined) => Uint8Array;
|
|
23
23
|
/**
|
|
@@ -27,8 +27,8 @@ export declare const asPGM: (buf: IntBuffer, comments?: string[] | undefined) =>
|
|
|
27
27
|
* @remarks
|
|
28
28
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
29
29
|
*
|
|
30
|
-
* @param buf
|
|
31
|
-
* @param comments
|
|
30
|
+
* @param buf -
|
|
31
|
+
* @param comments -
|
|
32
32
|
*/
|
|
33
33
|
export declare const asPGM16: (buf: IntBuffer, comments?: string[] | undefined) => Uint8Array;
|
|
34
34
|
/**
|
|
@@ -37,8 +37,8 @@ export declare const asPGM16: (buf: IntBuffer, comments?: string[] | undefined)
|
|
|
37
37
|
* @remarks
|
|
38
38
|
* Reference: http://netpbm.sourceforge.net/doc/ppm.html
|
|
39
39
|
*
|
|
40
|
-
* @param buf
|
|
41
|
-
* @param comments
|
|
40
|
+
* @param buf -
|
|
41
|
+
* @param comments -
|
|
42
42
|
*/
|
|
43
43
|
export declare const asPPM: (buf: IntBuffer, comments?: string[] | undefined) => Uint8Array;
|
|
44
44
|
//# sourceMappingURL=write.d.ts.map
|
package/write.js
CHANGED
|
@@ -4,10 +4,10 @@ const formatComments = (comments = ["generated by @thi.ng/pixel-io-netpbm"]) =>
|
|
|
4
4
|
* Initializes byte array & PBM header for given {@link IntBuffer} and format
|
|
5
5
|
* details.
|
|
6
6
|
*
|
|
7
|
-
* @param magic
|
|
8
|
-
* @param limits
|
|
9
|
-
* @param size
|
|
10
|
-
* @param buf
|
|
7
|
+
* @param magic -
|
|
8
|
+
* @param limits -
|
|
9
|
+
* @param size -
|
|
10
|
+
* @param buf -
|
|
11
11
|
*
|
|
12
12
|
* @internal
|
|
13
13
|
*/
|
|
@@ -30,8 +30,8 @@ const initHeader = (magic, limits, size, buf, comments) => {
|
|
|
30
30
|
* @remarks
|
|
31
31
|
* Reference: http://netpbm.sourceforge.net/doc/pbm.html
|
|
32
32
|
*
|
|
33
|
-
* @param buf
|
|
34
|
-
* @param comments
|
|
33
|
+
* @param buf -
|
|
34
|
+
* @param comments -
|
|
35
35
|
*/
|
|
36
36
|
export const asPBM = (buf, comments) => {
|
|
37
37
|
const { data, width, height } = buf;
|
|
@@ -58,8 +58,8 @@ export const asPBM = (buf, comments) => {
|
|
|
58
58
|
* @remarks
|
|
59
59
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
60
60
|
*
|
|
61
|
-
* @param buf
|
|
62
|
-
* @param comments
|
|
61
|
+
* @param buf -
|
|
62
|
+
* @param comments -
|
|
63
63
|
*/
|
|
64
64
|
export const asPGM = (buf, comments) => {
|
|
65
65
|
const { data, width, height } = buf;
|
|
@@ -76,8 +76,8 @@ export const asPGM = (buf, comments) => {
|
|
|
76
76
|
* @remarks
|
|
77
77
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
78
78
|
*
|
|
79
|
-
* @param buf
|
|
80
|
-
* @param comments
|
|
79
|
+
* @param buf -
|
|
80
|
+
* @param comments -
|
|
81
81
|
*/
|
|
82
82
|
export const asPGM16 = (buf, comments) => {
|
|
83
83
|
if (buf.format !== GRAY16)
|
|
@@ -96,8 +96,8 @@ export const asPGM16 = (buf, comments) => {
|
|
|
96
96
|
* @remarks
|
|
97
97
|
* Reference: http://netpbm.sourceforge.net/doc/ppm.html
|
|
98
98
|
*
|
|
99
|
-
* @param buf
|
|
100
|
-
* @param comments
|
|
99
|
+
* @param buf -
|
|
100
|
+
* @param comments -
|
|
101
101
|
*/
|
|
102
102
|
export const asPPM = (buf, comments) => {
|
|
103
103
|
const { data, width, height } = buf;
|