@thi.ng/pixel-io-netpbm 2.1.35 → 2.1.36
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 +1 -1
- package/package.json +4 -4
- package/read.d.ts +17 -11
- package/read.js +17 -11
package/CHANGELOG.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.36",
|
|
4
4
|
"description": "Multi-format NetPBM reader & writer support for @thi.ng/pixel",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.6.
|
|
37
|
+
"@thi.ng/api": "^8.6.1",
|
|
38
38
|
"@thi.ng/errors": "^2.2.6",
|
|
39
|
-
"@thi.ng/pixel": "^4.0.
|
|
39
|
+
"@thi.ng/pixel": "^4.0.12"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@microsoft/api-extractor": "^7.33.7",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"parent": "@thi.ng/pixel",
|
|
87
87
|
"year": 2021
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
90
90
|
}
|
package/read.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export declare const parseHeader: (src: Uint8Array) => {
|
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Takes a PBM/PGM/PPM file as byte array and parses it into a
|
|
16
|
-
*
|
|
16
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) of
|
|
17
|
+
* corresponding format.
|
|
17
18
|
*
|
|
18
19
|
* @remarks
|
|
19
20
|
* Depending on header information, the following rules apply:
|
|
@@ -31,8 +32,9 @@ export declare const parseHeader: (src: Uint8Array) => {
|
|
|
31
32
|
export declare const read: (src: Uint8Array) => import("@thi.ng/pixel/int").IntBuffer;
|
|
32
33
|
/**
|
|
33
34
|
* Reads pixels from given 1bit PBM file byte buffer, starting at index `i` and
|
|
34
|
-
* returns
|
|
35
|
-
*
|
|
35
|
+
* returns
|
|
36
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
37
|
+
* `GRAY8` format (due to current lack of true 1bit format).
|
|
36
38
|
*
|
|
37
39
|
* @param src -
|
|
38
40
|
* @param i -
|
|
@@ -42,9 +44,10 @@ export declare const read: (src: Uint8Array) => import("@thi.ng/pixel/int").IntB
|
|
|
42
44
|
export declare const readPBM: (src: Uint8Array, i: number, width: number, height: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
43
45
|
/**
|
|
44
46
|
* Reads pixels from given 8bit PGM file byte buffer, starting at index `i` and
|
|
45
|
-
* returns
|
|
46
|
-
*
|
|
47
|
-
*
|
|
47
|
+
* returns
|
|
48
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
49
|
+
* `GRAY8` format. If needed, pixel values are rescaled given `max` value
|
|
50
|
+
* defined in PGM header (MUST be <= 0xff).
|
|
48
51
|
*
|
|
49
52
|
* @remarks
|
|
50
53
|
* Reference: http://netpbm.sourceforge.net/doc/pbm.html
|
|
@@ -58,8 +61,10 @@ export declare const readPBM: (src: Uint8Array, i: number, width: number, height
|
|
|
58
61
|
export declare const readPGM8: (src: Uint8Array, i: number, width: number, height: number, max?: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
59
62
|
/**
|
|
60
63
|
* Reads pixels from given 16bit PGM file byte buffer, starting at index `i` and
|
|
61
|
-
* returns
|
|
62
|
-
*
|
|
64
|
+
* returns
|
|
65
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
66
|
+
* `GRAY16` format. Pixel values are rescaled given `max` value defined in PGM
|
|
67
|
+
* header (MUST be <= 0xffff).
|
|
63
68
|
*
|
|
64
69
|
* @remarks
|
|
65
70
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
@@ -73,9 +78,10 @@ export declare const readPGM8: (src: Uint8Array, i: number, width: number, heigh
|
|
|
73
78
|
export declare const readPGM16: (src: Uint8Array, i: number, width: number, height: number, max?: number) => import("@thi.ng/pixel/int").IntBuffer;
|
|
74
79
|
/**
|
|
75
80
|
* Reads pixels from given 24bit PPM file byte buffer, starting at index `i` and
|
|
76
|
-
* returns
|
|
77
|
-
*
|
|
78
|
-
*
|
|
81
|
+
* returns
|
|
82
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
83
|
+
* `RGB888` format. Color channel values are rescaled given `max` value defined
|
|
84
|
+
* in PGM header (MUST be <= 0xff).
|
|
79
85
|
*
|
|
80
86
|
* @remarks
|
|
81
87
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
package/read.js
CHANGED
|
@@ -62,7 +62,8 @@ export const parseHeader = (src) => {
|
|
|
62
62
|
};
|
|
63
63
|
/**
|
|
64
64
|
* Takes a PBM/PGM/PPM file as byte array and parses it into a
|
|
65
|
-
*
|
|
65
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) of
|
|
66
|
+
* corresponding format.
|
|
66
67
|
*
|
|
67
68
|
* @remarks
|
|
68
69
|
* Depending on header information, the following rules apply:
|
|
@@ -94,8 +95,9 @@ export const read = (src) => {
|
|
|
94
95
|
};
|
|
95
96
|
/**
|
|
96
97
|
* Reads pixels from given 1bit PBM file byte buffer, starting at index `i` and
|
|
97
|
-
* returns
|
|
98
|
-
*
|
|
98
|
+
* returns
|
|
99
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
100
|
+
* `GRAY8` format (due to current lack of true 1bit format).
|
|
99
101
|
*
|
|
100
102
|
* @param src -
|
|
101
103
|
* @param i -
|
|
@@ -117,9 +119,10 @@ export const readPBM = (src, i, width, height) => {
|
|
|
117
119
|
};
|
|
118
120
|
/**
|
|
119
121
|
* Reads pixels from given 8bit PGM file byte buffer, starting at index `i` and
|
|
120
|
-
* returns
|
|
121
|
-
*
|
|
122
|
-
*
|
|
122
|
+
* returns
|
|
123
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
124
|
+
* `GRAY8` format. If needed, pixel values are rescaled given `max` value
|
|
125
|
+
* defined in PGM header (MUST be <= 0xff).
|
|
123
126
|
*
|
|
124
127
|
* @remarks
|
|
125
128
|
* Reference: http://netpbm.sourceforge.net/doc/pbm.html
|
|
@@ -146,8 +149,10 @@ export const readPGM8 = (src, i, width, height, max = 0xff) => {
|
|
|
146
149
|
};
|
|
147
150
|
/**
|
|
148
151
|
* Reads pixels from given 16bit PGM file byte buffer, starting at index `i` and
|
|
149
|
-
* returns
|
|
150
|
-
*
|
|
152
|
+
* returns
|
|
153
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
154
|
+
* `GRAY16` format. Pixel values are rescaled given `max` value defined in PGM
|
|
155
|
+
* header (MUST be <= 0xffff).
|
|
151
156
|
*
|
|
152
157
|
* @remarks
|
|
153
158
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|
|
@@ -169,9 +174,10 @@ export const readPGM16 = (src, i, width, height, max = 0xffff) => {
|
|
|
169
174
|
};
|
|
170
175
|
/**
|
|
171
176
|
* Reads pixels from given 24bit PPM file byte buffer, starting at index `i` and
|
|
172
|
-
* returns
|
|
173
|
-
*
|
|
174
|
-
*
|
|
177
|
+
* returns
|
|
178
|
+
* [`IntBuffer`](https://docs.thi.ng/umbrella/pixel/classes/IntBuffer.html) in
|
|
179
|
+
* `RGB888` format. Color channel values are rescaled given `max` value defined
|
|
180
|
+
* in PGM header (MUST be <= 0xff).
|
|
175
181
|
*
|
|
176
182
|
* @remarks
|
|
177
183
|
* Reference: http://netpbm.sourceforge.net/doc/pgm.html
|