@thi.ng/imago 1.1.2 → 1.1.4
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 +8 -1
- package/README.md +16 -1
- package/ops/output.js +13 -3
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2025-
|
|
3
|
+
- **Last updated**: 2025-07-02T09:55:21Z
|
|
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,13 @@ 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.3](https://github.com/thi-ng/umbrella/tree/@thi.ng/imago@1.1.3) (2025-07-02)
|
|
15
|
+
|
|
16
|
+
#### 🩹 Bug fixes
|
|
17
|
+
|
|
18
|
+
- update non-file (in-memory) output handling ([cef4642](https://github.com/thi-ng/umbrella/commit/cef4642))
|
|
19
|
+
- update `outputProc()` if no path is given
|
|
20
|
+
|
|
14
21
|
## [1.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/imago@1.1.0) (2025-05-28)
|
|
15
22
|
|
|
16
23
|
#### 🚀 Features
|
package/README.md
CHANGED
|
@@ -260,6 +260,21 @@ be written.
|
|
|
260
260
|
|
|
261
261
|
For all other formats, if no output path is provided in the spec, no file will
|
|
262
262
|
be written, but the encoded image buffer itself will be recorded in the outputs.
|
|
263
|
+
Use the `raw` output option to obtain the raw pixel data (number of channels
|
|
264
|
+
used will depend on previous operations).
|
|
265
|
+
|
|
266
|
+
```js
|
|
267
|
+
import { processImage, output } from "@thi.ng/imago";
|
|
268
|
+
|
|
269
|
+
const result = await processImage(
|
|
270
|
+
"example.png",
|
|
271
|
+
[output({id: "main", raw: { alpha: false } })]
|
|
272
|
+
);
|
|
273
|
+
|
|
274
|
+
// raw pixel data buffer
|
|
275
|
+
result.outputs.main
|
|
276
|
+
// <Buffer ...>
|
|
277
|
+
```
|
|
263
278
|
|
|
264
279
|
#### Templated output paths
|
|
265
280
|
|
|
@@ -360,7 +375,7 @@ For Node.js REPL:
|
|
|
360
375
|
const imago = await import("@thi.ng/imago");
|
|
361
376
|
```
|
|
362
377
|
|
|
363
|
-
Package sizes (brotli'd, pre-treeshake): ESM: 5.
|
|
378
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 5.05 KB
|
|
364
379
|
|
|
365
380
|
## Dependencies
|
|
366
381
|
|
package/ops/output.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { encode } from "@thi.ng/blurhash";
|
|
2
2
|
import { isNumber, isPlainObject } from "@thi.ng/checks";
|
|
3
3
|
import { writeFile, writeJSON } from "@thi.ng/file-io";
|
|
4
|
+
import { firstNonNullKey } from "@thi.ng/object-utils/first-non-null";
|
|
4
5
|
import { join, resolve } from "node:path";
|
|
5
6
|
import { formatPath } from "../path.js";
|
|
6
|
-
import { illegalArgs } from "@thi.ng/errors";
|
|
7
7
|
const outputProc = async (spec, input, ctx) => {
|
|
8
8
|
const opts = spec;
|
|
9
9
|
const outDir = resolve(ctx.opts.outDir || ".");
|
|
@@ -12,7 +12,6 @@ const outputProc = async (spec, input, ctx) => {
|
|
|
12
12
|
await __outputBlurHash(opts, output, ctx);
|
|
13
13
|
return [input, false];
|
|
14
14
|
}
|
|
15
|
-
if (!opts.path) illegalArgs("output path missing");
|
|
16
15
|
if (opts.raw) {
|
|
17
16
|
await __outputRaw(opts, output, ctx, outDir);
|
|
18
17
|
return [input, false];
|
|
@@ -30,7 +29,18 @@ const outputProc = async (spec, input, ctx) => {
|
|
|
30
29
|
ctx.logger.debug("using stored ICC profile:", ctx.iccFile);
|
|
31
30
|
output = output.withIccProfile(ctx.iccFile);
|
|
32
31
|
}
|
|
33
|
-
let format = /\.(\w+)$/.exec(opts.path)?.[1]
|
|
32
|
+
let format = opts.path ? /\.(\w+)$/.exec(opts.path)?.[1] : firstNonNullKey(opts, [
|
|
33
|
+
"avif",
|
|
34
|
+
"gif",
|
|
35
|
+
"jp2",
|
|
36
|
+
"jpeg",
|
|
37
|
+
"jxl",
|
|
38
|
+
"png",
|
|
39
|
+
"raw",
|
|
40
|
+
"tile",
|
|
41
|
+
"tiff",
|
|
42
|
+
"webp"
|
|
43
|
+
]);
|
|
34
44
|
switch (format) {
|
|
35
45
|
case "avif":
|
|
36
46
|
if (opts.avif) output = output.avif(opts.avif);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/imago",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"description": "JSON & API-based declarative and extensible image processing trees/pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@thi.ng/date": "^2.7.55",
|
|
46
46
|
"@thi.ng/defmulti": "^3.0.69",
|
|
47
47
|
"@thi.ng/errors": "^2.5.35",
|
|
48
|
-
"@thi.ng/file-io": "^2.
|
|
48
|
+
"@thi.ng/file-io": "^2.2.0",
|
|
49
49
|
"@thi.ng/logger": "^3.1.10",
|
|
50
|
-
"@thi.ng/object-utils": "^1.1
|
|
50
|
+
"@thi.ng/object-utils": "^1.2.1",
|
|
51
51
|
"@thi.ng/pixel": "^7.5.1",
|
|
52
52
|
"@thi.ng/pixel-dither": "^1.1.169",
|
|
53
53
|
"@thi.ng/prefixes": "^2.3.46",
|
|
@@ -189,5 +189,5 @@
|
|
|
189
189
|
"status": "alpha",
|
|
190
190
|
"year": 2024
|
|
191
191
|
},
|
|
192
|
-
"gitHead": "
|
|
192
|
+
"gitHead": "06e582f962a9cd3abb905e91d97d652e1d3bb971\n"
|
|
193
193
|
}
|