@blazediff/bin 3.1.0 → 3.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 +4 -8
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/index.mjs +0 -2
- package/package.json +8 -7
- package/dist/index.d.mts +0 -61
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@blazediff/bin)
|
|
6
6
|
[](https://www.npmjs.com/package/@blazediff/bin)
|
|
7
|
+
[](https://crates.io/crates/blazediff)
|
|
7
8
|
|
|
8
9
|
</div>
|
|
9
10
|
|
|
@@ -27,6 +28,8 @@ The fastest single-threaded image diff in the world. Native Rust implementation
|
|
|
27
28
|
npm install @blazediff/bin
|
|
28
29
|
```
|
|
29
30
|
|
|
31
|
+
Also available as a Rust crate: [`cargo install blazediff`](https://crates.io/crates/blazediff)
|
|
32
|
+
|
|
30
33
|
Pre-built [binaries](https://github.com/teimurjan/blazediff/tree/main/packages/bin/binaries) are included for:
|
|
31
34
|
- macOS ARM64 (Apple Silicon)
|
|
32
35
|
- macOS x64 (Intel)
|
|
@@ -96,12 +99,6 @@ Compare two images (PNG or JPEG) and generate a diff image. Format is auto-detec
|
|
|
96
99
|
<td>false</td>
|
|
97
100
|
<td>Output only differences with transparent background</td>
|
|
98
101
|
</tr>
|
|
99
|
-
<tr>
|
|
100
|
-
<td><code>failOnLayoutDiff</code></td>
|
|
101
|
-
<td>boolean</td>
|
|
102
|
-
<td>false</td>
|
|
103
|
-
<td>Fail immediately if images have different dimensions</td>
|
|
104
|
-
</tr>
|
|
105
102
|
</table>
|
|
106
103
|
|
|
107
104
|
### Result Types
|
|
@@ -174,7 +171,6 @@ Options:
|
|
|
174
171
|
-t, --threshold <THRESHOLD> Color difference threshold (0.0-1.0) [default: 0.1]
|
|
175
172
|
-a, --antialiasing Enable anti-aliasing detection
|
|
176
173
|
--diff-mask Output only differences (transparent background)
|
|
177
|
-
--fail-on-layout Fail on layout (size) difference
|
|
178
174
|
-c, --compression <LEVEL> PNG compression level (0-9, 0=fastest, 9=smallest) [default: 0]
|
|
179
175
|
-q, --quality <QUALITY> JPEG quality (1-100) [default: 90]
|
|
180
176
|
--output-format <FORMAT> Output format (json or text) [default: json]
|
|
@@ -194,7 +190,7 @@ Input images can be mixed formats (e.g., compare PNG to JPEG). Output format is
|
|
|
194
190
|
### Exit Codes
|
|
195
191
|
|
|
196
192
|
- `0` - Images are identical
|
|
197
|
-
- `1` - Images differ (
|
|
193
|
+
- `1` - Images differ (includes layout/size mismatch)
|
|
198
194
|
- `2` - Error (file not found, invalid format, etc.)
|
|
199
195
|
|
|
200
196
|
## Performance
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ interface BlazeDiffOptions {
|
|
|
5
5
|
antialiasing?: boolean;
|
|
6
6
|
/** Output only differences with transparent background */
|
|
7
7
|
diffMask?: boolean;
|
|
8
|
-
/** Fail immediately if images have different dimensions */
|
|
9
|
-
failOnLayoutDiff?: boolean;
|
|
10
8
|
/** PNG compression level (0-9, 0=fastest/largest, 9=slowest/smallest) */
|
|
11
9
|
compression?: number;
|
|
12
10
|
/** JPEG quality (1-100). Default: 90 */
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,6 @@ function convertToNapiOptions(options) {
|
|
|
145
145
|
threshold: options?.threshold,
|
|
146
146
|
antialiasing: options?.antialiasing,
|
|
147
147
|
diffMask: options?.diffMask,
|
|
148
|
-
failOnLayout: options?.failOnLayoutDiff,
|
|
149
148
|
compression: options?.compression,
|
|
150
149
|
quality: options?.quality
|
|
151
150
|
};
|
|
@@ -203,7 +202,6 @@ function buildArgs(diffOutput, options) {
|
|
|
203
202
|
args.push(`--threshold=${options.threshold}`);
|
|
204
203
|
if (options.antialiasing) args.push("--antialiasing");
|
|
205
204
|
if (options.diffMask) args.push("--diff-mask");
|
|
206
|
-
if (options.failOnLayoutDiff) args.push("--fail-on-layout");
|
|
207
205
|
if (options.compression !== void 0)
|
|
208
206
|
args.push(`--compression=${options.compression}`);
|
|
209
207
|
if (options.quality !== void 0) args.push(`--quality=${options.quality}`);
|
package/dist/index.mjs
CHANGED
|
@@ -103,7 +103,6 @@ function convertToNapiOptions(options) {
|
|
|
103
103
|
threshold: options?.threshold,
|
|
104
104
|
antialiasing: options?.antialiasing,
|
|
105
105
|
diffMask: options?.diffMask,
|
|
106
|
-
failOnLayout: options?.failOnLayoutDiff,
|
|
107
106
|
compression: options?.compression,
|
|
108
107
|
quality: options?.quality
|
|
109
108
|
};
|
|
@@ -161,7 +160,6 @@ function buildArgs(diffOutput, options) {
|
|
|
161
160
|
args.push(`--threshold=${options.threshold}`);
|
|
162
161
|
if (options.antialiasing) args.push("--antialiasing");
|
|
163
162
|
if (options.diffMask) args.push("--diff-mask");
|
|
164
|
-
if (options.failOnLayoutDiff) args.push("--fail-on-layout");
|
|
165
163
|
if (options.compression !== void 0)
|
|
166
164
|
args.push(`--compression=${options.compression}`);
|
|
167
165
|
if (options.quality !== void 0) args.push(`--quality=${options.quality}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazediff/bin",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.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/bin-darwin-arm64": "3.
|
|
24
|
-
"@blazediff/bin-darwin-x64": "3.
|
|
25
|
-
"@blazediff/bin-linux-arm64": "3.
|
|
26
|
-
"@blazediff/bin-linux-x64": "3.
|
|
27
|
-
"@blazediff/bin-win32-arm64": "3.
|
|
28
|
-
"@blazediff/bin-win32-x64": "3.
|
|
23
|
+
"@blazediff/bin-darwin-arm64": "3.2.0",
|
|
24
|
+
"@blazediff/bin-darwin-x64": "3.2.0",
|
|
25
|
+
"@blazediff/bin-linux-arm64": "3.2.0",
|
|
26
|
+
"@blazediff/bin-linux-x64": "3.2.0",
|
|
27
|
+
"@blazediff/bin-win32-arm64": "3.2.0",
|
|
28
|
+
"@blazediff/bin-win32-x64": "3.2.0"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [
|
|
31
31
|
"image",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"typescript": "5.9.2"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
53
54
|
"build": "tsup",
|
|
54
55
|
"clean": "rm -rf dist"
|
|
55
56
|
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
interface BlazeDiffOptions {
|
|
2
|
-
/** Color difference threshold (0.0-1.0). Lower = more strict. Default: 0.1 */
|
|
3
|
-
threshold?: number;
|
|
4
|
-
/** Enable anti-aliasing detection to exclude AA pixels from diff count */
|
|
5
|
-
antialiasing?: boolean;
|
|
6
|
-
/** Output only differences with transparent background */
|
|
7
|
-
diffMask?: boolean;
|
|
8
|
-
/** Fail immediately if images have different dimensions */
|
|
9
|
-
failOnLayoutDiff?: boolean;
|
|
10
|
-
/** PNG compression level (0-9, 0=fastest/largest, 9=slowest/smallest) */
|
|
11
|
-
compression?: number;
|
|
12
|
-
/** JPEG quality (1-100). Default: 90 */
|
|
13
|
-
quality?: number;
|
|
14
|
-
}
|
|
15
|
-
type BlazeDiffResult = {
|
|
16
|
-
match: true;
|
|
17
|
-
} | {
|
|
18
|
-
match: false;
|
|
19
|
-
reason: "layout-diff";
|
|
20
|
-
} | {
|
|
21
|
-
match: false;
|
|
22
|
-
reason: "pixel-diff";
|
|
23
|
-
diffCount: number;
|
|
24
|
-
diffPercentage: number;
|
|
25
|
-
} | {
|
|
26
|
-
match: false;
|
|
27
|
-
reason: "file-not-exists";
|
|
28
|
-
file: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Compare two images (PNG or JPEG) and optionally generate a diff image.
|
|
32
|
-
*
|
|
33
|
-
* Uses native N-API bindings when available for ~10-100x better performance
|
|
34
|
-
* on small images (no process spawn overhead). Falls back to execFile if
|
|
35
|
-
* native bindings are unavailable.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* // With diff output
|
|
40
|
-
* const result = await compare('expected.png', 'actual.png', 'diff.png');
|
|
41
|
-
*
|
|
42
|
-
* // Without diff output (faster, just returns comparison result)
|
|
43
|
-
* const result = await compare('expected.png', 'actual.png');
|
|
44
|
-
*
|
|
45
|
-
* if (result.match) {
|
|
46
|
-
* console.log('Images identical');
|
|
47
|
-
* } else if (result.reason === 'pixel-diff') {
|
|
48
|
-
* console.log(`${result.diffCount} pixels differ`);
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
declare function compare(basePath: string, comparePath: string, diffOutput?: string, options?: BlazeDiffOptions): Promise<BlazeDiffResult>;
|
|
53
|
-
/** Get the path to the blazediff binary for direct CLI usage. */
|
|
54
|
-
declare function getBinaryPath(): string;
|
|
55
|
-
/**
|
|
56
|
-
* Check if native N-API bindings are available.
|
|
57
|
-
* Returns true if the native module loaded successfully.
|
|
58
|
-
*/
|
|
59
|
-
declare function hasNativeBinding(): boolean;
|
|
60
|
-
|
|
61
|
-
export { type BlazeDiffOptions, type BlazeDiffResult, compare, getBinaryPath, hasNativeBinding };
|