@thi.ng/pixel-dither 1.1.135 → 1.1.137
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 +5 -4
- package/dither.js +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-07-
|
|
3
|
+
- **Last updated**: 2024-07-22T13:15:57Z
|
|
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
|
+
### [1.1.136](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-dither@1.1.136) (2024-07-22)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update imports ([a748565](https://github.com/thi-ng/umbrella/commit/a748565))
|
|
17
|
+
|
|
12
18
|
### [1.1.131](https://github.com/thi-ng/umbrella/tree/@thi.ng/pixel-dither@1.1.131) (2024-06-21)
|
|
13
19
|
|
|
14
20
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 198 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
|
>
|
|
@@ -75,7 +75,7 @@ For Node.js REPL:
|
|
|
75
75
|
const pd = await import("@thi.ng/pixel-dither");
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 1.
|
|
78
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 1.06 KB
|
|
79
79
|
|
|
80
80
|
## Dependencies
|
|
81
81
|
|
|
@@ -100,10 +100,11 @@ directory are using this package:
|
|
|
100
100
|
[Generated API docs](https://docs.thi.ng/umbrella/pixel-dither/)
|
|
101
101
|
|
|
102
102
|
```ts
|
|
103
|
-
import { intBufferFromImage, GRAY8 } from "@thi.ng/pixel";
|
|
103
|
+
import { imageFromURL, intBufferFromImage, GRAY8 } from "@thi.ng/pixel";
|
|
104
104
|
import { ditherWith, ATKINSON } from "@thi.ng/pixel-dither";
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
// create pixel buffer from HTML image element
|
|
107
|
+
const img = intBufferFromImage(await imageFromURL("test.jpg"));
|
|
107
108
|
|
|
108
109
|
// apply dithering to all channels in given pixel buffer
|
|
109
110
|
ditherWith(ATKINSON, img);
|
package/dither.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __range } from "@thi.ng/pixel/internal/range";
|
|
2
2
|
const ditherWith = (kernel, img, opts = {}) => {
|
|
3
3
|
const { bleed = 1, threshold = 0.5, channels } = opts;
|
|
4
4
|
const { format, width, height } = img;
|
|
5
5
|
const { ox, oy, weights, shift } = kernel;
|
|
6
6
|
let p, err;
|
|
7
|
-
for (let cid of channels ||
|
|
7
|
+
for (let cid of channels || __range(format.channels.length)) {
|
|
8
8
|
const cimg = img.getChannel(cid);
|
|
9
9
|
const chan = format.channels[cid];
|
|
10
10
|
const $thresh = chan.num * threshold;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/pixel-dither",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.137",
|
|
4
4
|
"description": "Extensible image dithering w/ various algorithm presets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/checks": "^3.6.
|
|
40
|
-
"@thi.ng/math": "^5.11.
|
|
41
|
-
"@thi.ng/pixel": "^
|
|
39
|
+
"@thi.ng/checks": "^3.6.9",
|
|
40
|
+
"@thi.ng/math": "^5.11.5",
|
|
41
|
+
"@thi.ng/pixel": "^7.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@microsoft/api-extractor": "^7.47.0",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"parent": "@thi.ng/pixel",
|
|
106
106
|
"year": 2021
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "ec052b25dff4db6c4d1748e946c38fb5cf403dbf\n"
|
|
109
109
|
}
|