@blazediff/core-native 5.1.0 → 5.2.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/README.md +9 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +18 -7
- package/dist/index.mjs +18 -7
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -108,11 +108,17 @@ Compare two images (PNG or JPEG) and generate a diff image. Format is auto-detec
|
|
|
108
108
|
<td>false</td>
|
|
109
109
|
<td>Output only differences with transparent background</td>
|
|
110
110
|
</tr>
|
|
111
|
+
<tr>
|
|
112
|
+
<td><code>diffColorAlt</code></td>
|
|
113
|
+
<td>[number, number, number]</td>
|
|
114
|
+
<td>diff color</td>
|
|
115
|
+
<td>Alternative RGB color for darkening differences</td>
|
|
116
|
+
</tr>
|
|
111
117
|
<tr>
|
|
112
118
|
<td><code>interpret</code></td>
|
|
113
119
|
<td>boolean</td>
|
|
114
120
|
<td>false</td>
|
|
115
|
-
<td>
|
|
121
|
+
<td>Generate the diff image and structured interpretation in one pass, adding <code>interpretation</code> to the result</td>
|
|
116
122
|
</tr>
|
|
117
123
|
</table>
|
|
118
124
|
|
|
@@ -272,9 +278,11 @@ Options:
|
|
|
272
278
|
-t, --threshold <THRESHOLD> Color difference threshold (0.0-1.0) [default: 0.1]
|
|
273
279
|
-a, --antialiasing Enable anti-aliasing detection
|
|
274
280
|
--diff-mask Output only differences (transparent background)
|
|
281
|
+
--diff-color-alt <R,G,B> Alternative RGB color for darkening differences
|
|
275
282
|
-c, --compression <LEVEL> PNG compression level (0-9, 0=fastest, 9=smallest) [default: 0]
|
|
276
283
|
-q, --quality <QUALITY> JPEG quality (1-100) [default: 90]
|
|
277
284
|
--output-format <FORMAT> Output format (json or text) [default: json]
|
|
285
|
+
--interpret Generate diff output and structured interpretation
|
|
278
286
|
-h, --help Print help
|
|
279
287
|
-V, --version Print version
|
|
280
288
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ interface BlazeDiffOptions {
|
|
|
5
5
|
antialiasing?: boolean;
|
|
6
6
|
/** Output only differences with transparent background */
|
|
7
7
|
diffMask?: boolean;
|
|
8
|
+
/** Alternative RGB color for darkening differences. Default: diff color */
|
|
9
|
+
diffColorAlt?: [number, number, number];
|
|
8
10
|
/** PNG compression level (0-9, 0=fastest/largest, 9=slowest/smallest) */
|
|
9
11
|
compression?: number;
|
|
10
12
|
/** JPEG quality (1-100). Default: 90 */
|
package/dist/index.js
CHANGED
|
@@ -50,6 +50,17 @@ var import_node_path = __toESM(require("path"));
|
|
|
50
50
|
var import_node_url = require("url");
|
|
51
51
|
var import_node_util = require("util");
|
|
52
52
|
var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
53
|
+
function validateRgb(color) {
|
|
54
|
+
if (!color) return void 0;
|
|
55
|
+
if (color.length !== 3 || color.some(
|
|
56
|
+
(channel) => !Number.isInteger(channel) || channel < 0 || channel > 255
|
|
57
|
+
)) {
|
|
58
|
+
throw new RangeError(
|
|
59
|
+
"diffColorAlt must contain three integer RGB channels"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return color;
|
|
63
|
+
}
|
|
53
64
|
var PLATFORM_PACKAGES = {
|
|
54
65
|
"darwin-arm64": {
|
|
55
66
|
packageName: "@blazediff/core-native-darwin-arm64",
|
|
@@ -140,6 +151,7 @@ function convertToNapiOptions(options) {
|
|
|
140
151
|
threshold: options?.threshold,
|
|
141
152
|
antialiasing: options?.antialiasing,
|
|
142
153
|
diffMask: options?.diffMask,
|
|
154
|
+
diffColorAlt: validateRgb(options?.diffColorAlt),
|
|
143
155
|
compression: options?.compression,
|
|
144
156
|
quality: options?.quality,
|
|
145
157
|
interpret: options?.interpret
|
|
@@ -199,13 +211,12 @@ function buildArgs(diffOutput, options) {
|
|
|
199
211
|
if (options.threshold !== void 0)
|
|
200
212
|
args.push(`--threshold=${options.threshold}`);
|
|
201
213
|
if (options.antialiasing) args.push("--antialiasing");
|
|
202
|
-
if (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
214
|
+
if (options.diffMask) args.push("--diff-mask");
|
|
215
|
+
const diffColorAlt = validateRgb(options.diffColorAlt);
|
|
216
|
+
if (diffColorAlt) args.push(`--diff-color-alt=${diffColorAlt.join(",")}`);
|
|
217
|
+
if (options.compression !== void 0)
|
|
218
|
+
args.push(`--compression=${options.compression}`);
|
|
219
|
+
if (options.quality !== void 0) args.push(`--quality=${options.quality}`);
|
|
209
220
|
return args;
|
|
210
221
|
}
|
|
211
222
|
function parseJsonOutput(text) {
|
package/dist/index.mjs
CHANGED
|
@@ -7,6 +7,17 @@ import path from "path";
|
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
import { promisify } from "util";
|
|
9
9
|
var execFileAsync = promisify(execFile);
|
|
10
|
+
function validateRgb(color) {
|
|
11
|
+
if (!color) return void 0;
|
|
12
|
+
if (color.length !== 3 || color.some(
|
|
13
|
+
(channel) => !Number.isInteger(channel) || channel < 0 || channel > 255
|
|
14
|
+
)) {
|
|
15
|
+
throw new RangeError(
|
|
16
|
+
"diffColorAlt must contain three integer RGB channels"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
return color;
|
|
20
|
+
}
|
|
10
21
|
var PLATFORM_PACKAGES = {
|
|
11
22
|
"darwin-arm64": {
|
|
12
23
|
packageName: "@blazediff/core-native-darwin-arm64",
|
|
@@ -97,6 +108,7 @@ function convertToNapiOptions(options) {
|
|
|
97
108
|
threshold: options?.threshold,
|
|
98
109
|
antialiasing: options?.antialiasing,
|
|
99
110
|
diffMask: options?.diffMask,
|
|
111
|
+
diffColorAlt: validateRgb(options?.diffColorAlt),
|
|
100
112
|
compression: options?.compression,
|
|
101
113
|
quality: options?.quality,
|
|
102
114
|
interpret: options?.interpret
|
|
@@ -156,13 +168,12 @@ function buildArgs(diffOutput, options) {
|
|
|
156
168
|
if (options.threshold !== void 0)
|
|
157
169
|
args.push(`--threshold=${options.threshold}`);
|
|
158
170
|
if (options.antialiasing) args.push("--antialiasing");
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
171
|
+
if (options.diffMask) args.push("--diff-mask");
|
|
172
|
+
const diffColorAlt = validateRgb(options.diffColorAlt);
|
|
173
|
+
if (diffColorAlt) args.push(`--diff-color-alt=${diffColorAlt.join(",")}`);
|
|
174
|
+
if (options.compression !== void 0)
|
|
175
|
+
args.push(`--compression=${options.compression}`);
|
|
176
|
+
if (options.quality !== void 0) args.push(`--quality=${options.quality}`);
|
|
166
177
|
return args;
|
|
167
178
|
}
|
|
168
179
|
function parseJsonOutput(text) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazediff/core-native",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"description": "Native Rust binaries for blazediff - the fastest image diff in the world",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@blazediff/core-native-darwin-arm64": "5.
|
|
24
|
-
"@blazediff/core-native-darwin-x64": "5.
|
|
25
|
-
"@blazediff/core-native-linux-arm64": "5.
|
|
26
|
-
"@blazediff/core-native-linux-x64": "5.
|
|
27
|
-
"@blazediff/core-native-win32-arm64": "5.
|
|
28
|
-
"@blazediff/core-native-win32-x64": "5.
|
|
23
|
+
"@blazediff/core-native-darwin-arm64": "5.2.0",
|
|
24
|
+
"@blazediff/core-native-darwin-x64": "5.2.0",
|
|
25
|
+
"@blazediff/core-native-linux-arm64": "5.2.0",
|
|
26
|
+
"@blazediff/core-native-linux-x64": "5.2.0",
|
|
27
|
+
"@blazediff/core-native-win32-arm64": "5.2.0",
|
|
28
|
+
"@blazediff/core-native-win32-x64": "5.2.0"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"image",
|