@thi.ng/pixel-convolve 1.0.32 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2025-04-30T12:52:32Z
3
+ - **Last updated**: 2025-05-28T12:02:40Z
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.
@@ -11,6 +11,17 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
11
11
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
12
12
  and/or version bumps of transitive dependencies.
13
13
 
14
+ ## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-convolve@1.1.0) (2025-05-28)
15
+
16
+ #### 🚀 Features
17
+
18
+ - add/update kernels ([24051c3](https://github.com/thi-ng/umbrella/commit/24051c3))
19
+ - add `EDGE3`, `EDGE5`
20
+
21
+ #### 🩹 Bug fixes
22
+
23
+ - swap `SOBEL_X`/`SOBEL_Y` to correct axis ([7bef58a](https://github.com/thi-ng/umbrella/commit/7bef58a))
24
+
14
25
  ## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-convolve@0.1.0) (2024-07-22)
15
26
 
16
27
  #### 🚀 Features
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 206 standalone projects, maintained as part
10
+ > This is one of 208 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
@@ -48,6 +48,8 @@ following convolution kernel presets are provided for convenience:
48
48
  |------------------|-------------|
49
49
  | `BOX_BLUR3` | 3x3 |
50
50
  | `BOX_BLUR5` | 5x5 |
51
+ | `EDGE3` | 3x3 |
52
+ | `EDGE5` | 5x5 |
51
53
  | `GAUSSIAN_BLUR3` | 3x3 |
52
54
  | `GAUSSIAN_BLUR5` | 5x5 |
53
55
  | `GAUSSIAN(n)` | 2n+1 x 2n+1 |
@@ -166,7 +168,7 @@ For Node.js REPL:
166
168
  const pc = await import("@thi.ng/pixel-convolve");
167
169
  ```
168
170
 
169
- Package sizes (brotli'd, pre-treeshake): ESM: 2.27 KB
171
+ Package sizes (brotli'd, pre-treeshake): ESM: 2.29 KB
170
172
 
171
173
  ## Dependencies
172
174
 
package/convolve.d.ts CHANGED
@@ -86,6 +86,8 @@ export declare const POOL_MAX: PoolTemplate;
86
86
  export declare const POOL_THRESHOLD: (bias?: number) => PoolTemplate;
87
87
  export declare const SOBEL_X: KernelSpec;
88
88
  export declare const SOBEL_Y: KernelSpec;
89
+ export declare const EDGE3: KernelSpec;
90
+ export declare const EDGE5: KernelSpec;
89
91
  export declare const SHARPEN3: KernelSpec;
90
92
  export declare const HIGHPASS3: KernelSpec;
91
93
  export declare const BOX_BLUR3: KernelSpec;
package/convolve.js CHANGED
@@ -176,19 +176,109 @@ const POOL_THRESHOLD = (bias = 0) => (body, w, h) => {
176
176
  return `(${center} - ${mean} + ${bias}) < 0 ? 0 : 1`;
177
177
  };
178
178
  const SOBEL_X = {
179
- spec: [-1, -2, -1, 0, 0, 0, 1, 2, 1],
179
+ // prettier-ignore
180
+ spec: [
181
+ -1,
182
+ 0,
183
+ 1,
184
+ -2,
185
+ 0,
186
+ 2,
187
+ -1,
188
+ 0,
189
+ 1
190
+ ],
180
191
  size: 3
181
192
  };
182
193
  const SOBEL_Y = {
183
- spec: [-1, 0, 1, -2, 0, 2, -1, 0, 1],
194
+ // prettier-ignore
195
+ spec: [
196
+ -1,
197
+ -2,
198
+ -1,
199
+ 0,
200
+ 0,
201
+ 0,
202
+ 1,
203
+ 2,
204
+ 1
205
+ ],
206
+ size: 3
207
+ };
208
+ const EDGE3 = {
209
+ // prettier-ignore
210
+ spec: [
211
+ -1,
212
+ -1,
213
+ -1,
214
+ -1,
215
+ 8,
216
+ -1,
217
+ -1,
218
+ -1,
219
+ -1
220
+ ],
184
221
  size: 3
185
222
  };
223
+ const EDGE5 = {
224
+ // prettier-ignore
225
+ spec: [
226
+ -1,
227
+ -1,
228
+ -1,
229
+ -1,
230
+ -1,
231
+ -1,
232
+ -1,
233
+ -1,
234
+ -1,
235
+ -1,
236
+ -1,
237
+ -1,
238
+ 24,
239
+ -1,
240
+ -1,
241
+ -1,
242
+ -1,
243
+ -1,
244
+ -1,
245
+ -1,
246
+ -1,
247
+ -1,
248
+ -1,
249
+ -1,
250
+ -1
251
+ ],
252
+ size: 5
253
+ };
186
254
  const SHARPEN3 = {
187
- spec: [0, -1, 0, -1, 5, -1, 0, -1, 0],
255
+ // prettier-ignore
256
+ spec: [
257
+ 0,
258
+ -1,
259
+ 0,
260
+ -1,
261
+ 5,
262
+ -1,
263
+ 0,
264
+ -1,
265
+ 0
266
+ ],
188
267
  size: 3
189
268
  };
190
269
  const HIGHPASS3 = {
191
- spec: [-1, -1, -1, -1, 9, -1, -1, -1, -1],
270
+ // prettier-ignore
271
+ spec: [
272
+ -1,
273
+ -1,
274
+ -1,
275
+ -1,
276
+ 9,
277
+ -1,
278
+ -1,
279
+ -1,
280
+ -1
281
+ ],
192
282
  size: 3
193
283
  };
194
284
  const BOX_BLUR3 = {
@@ -200,7 +290,18 @@ const BOX_BLUR5 = {
200
290
  size: 5
201
291
  };
202
292
  const GAUSSIAN_BLUR3 = {
203
- spec: [1 / 16, 1 / 8, 1 / 16, 1 / 8, 1 / 4, 1 / 8, 1 / 16, 1 / 8, 1 / 16],
293
+ // prettier-ignore
294
+ spec: [
295
+ 1 / 16,
296
+ 1 / 8,
297
+ 1 / 16,
298
+ 1 / 8,
299
+ 1 / 4,
300
+ 1 / 8,
301
+ 1 / 16,
302
+ 1 / 8,
303
+ 1 / 16
304
+ ],
204
305
  size: 3
205
306
  };
206
307
  const GAUSSIAN_BLUR5 = {
@@ -358,6 +459,8 @@ const MAXIMA8 = {
358
459
  export {
359
460
  BOX_BLUR3,
360
461
  BOX_BLUR5,
462
+ EDGE3,
463
+ EDGE5,
361
464
  GAUSSIAN,
362
465
  GAUSSIAN_BLUR3,
363
466
  GAUSSIAN_BLUR5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/pixel-convolve",
3
- "version": "1.0.32",
3
+ "version": "1.1.0",
4
4
  "description": "Extensible bitmap image convolution, kernel presets, normal map & image pyramid generation",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -39,15 +39,15 @@
39
39
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@thi.ng/api": "^8.11.27",
43
- "@thi.ng/checks": "^3.7.7",
44
- "@thi.ng/errors": "^2.5.33",
45
- "@thi.ng/math": "^5.11.27",
46
- "@thi.ng/pixel": "^7.4.5"
42
+ "@thi.ng/api": "^8.11.28",
43
+ "@thi.ng/checks": "^3.7.8",
44
+ "@thi.ng/errors": "^2.5.34",
45
+ "@thi.ng/math": "^5.11.28",
46
+ "@thi.ng/pixel": "^7.5.0"
47
47
  },
48
48
  "devDependencies": {
49
- "esbuild": "^0.25.3",
50
- "typedoc": "^0.28.3",
49
+ "esbuild": "^0.25.5",
50
+ "typedoc": "^0.28.5",
51
51
  "typescript": "^5.8.3"
52
52
  },
53
53
  "keywords": [
@@ -103,5 +103,5 @@
103
103
  "parent": "@thi.ng/pixel",
104
104
  "year": 2021
105
105
  },
106
- "gitHead": "4354686a6fb1f82c09ea48f92f87786191b231a0\n"
106
+ "gitHead": "61c3833b7ef7d044621454b5ea4af885d39f065e\n"
107
107
  }