@blazediff/bin 1.5.0 → 1.6.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 +71 -12
- package/dist/cli.js +898 -294
- package/dist/commands/diff.js +255 -0
- package/dist/commands/gmsd.js +201 -0
- package/dist/commands/hitchhikers-ssim.js +217 -0
- package/dist/commands/msssim.js +163 -0
- package/dist/commands/ssim.js +163 -0
- package/dist/index.d.mts +33 -10
- package/dist/index.d.ts +33 -10
- package/dist/index.js +1 -1
- package/dist/index.mjs +0 -1
- package/package.json +6 -5
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/commands/msssim.ts
|
|
32
|
+
var msssim_exports = {};
|
|
33
|
+
__export(msssim_exports, {
|
|
34
|
+
default: () => main
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(msssim_exports);
|
|
37
|
+
var import_msssim = __toESM(require("@blazediff/ssim/msssim"));
|
|
38
|
+
function printUsage() {
|
|
39
|
+
console.log(`
|
|
40
|
+
Usage: blazediff msssim <image1> <image2> [options]
|
|
41
|
+
|
|
42
|
+
Arguments:
|
|
43
|
+
image1 Path to the first image
|
|
44
|
+
image2 Path to the second image
|
|
45
|
+
|
|
46
|
+
Options:
|
|
47
|
+
-o, --output <path> Output path for MS-SSIM map visualization
|
|
48
|
+
--transformer <name> Specify transformer to use (e.g. pngjs, sharp)
|
|
49
|
+
-h, --help Show this help message
|
|
50
|
+
|
|
51
|
+
Examples:
|
|
52
|
+
blazediff msssim image1.png image2.png
|
|
53
|
+
blazediff msssim image1.png image2.png -o msssim-map.png
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
var getTransformer = async (transformer) => {
|
|
57
|
+
if (!transformer || transformer === "pngjs") {
|
|
58
|
+
const { default: transformer2 } = await import("@blazediff/pngjs-transformer");
|
|
59
|
+
return transformer2;
|
|
60
|
+
}
|
|
61
|
+
if (transformer === "sharp") {
|
|
62
|
+
const { default: transformer2 } = await import("@blazediff/sharp-transformer");
|
|
63
|
+
return transformer2;
|
|
64
|
+
}
|
|
65
|
+
throw new Error(`Unknown transformer: ${transformer}`);
|
|
66
|
+
};
|
|
67
|
+
async function main() {
|
|
68
|
+
try {
|
|
69
|
+
const args = process.argv.slice(2);
|
|
70
|
+
if (args.length === 0 || args.includes("-h") || args.includes("--help")) {
|
|
71
|
+
printUsage();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
if (args.length < 2) {
|
|
75
|
+
console.error("Error: Two image paths are required");
|
|
76
|
+
printUsage();
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
const image1 = args[0];
|
|
80
|
+
const image2 = args[1];
|
|
81
|
+
const options = {};
|
|
82
|
+
for (let i = 2; i < args.length; i++) {
|
|
83
|
+
const arg = args[i];
|
|
84
|
+
const nextArg = args[i + 1];
|
|
85
|
+
switch (arg) {
|
|
86
|
+
case "-o":
|
|
87
|
+
case "--output":
|
|
88
|
+
if (nextArg) {
|
|
89
|
+
options.outputPath = nextArg;
|
|
90
|
+
i++;
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case "--transformer":
|
|
94
|
+
if (nextArg) {
|
|
95
|
+
options.transformer = nextArg;
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
console.error(`Unknown option: ${arg}`);
|
|
101
|
+
printUsage();
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const transformer = await getTransformer(options.transformer);
|
|
106
|
+
const [img1, img2] = await Promise.all([
|
|
107
|
+
transformer.transform(image1),
|
|
108
|
+
transformer.transform(image2)
|
|
109
|
+
]);
|
|
110
|
+
if (img1.width !== img2.width || img1.height !== img2.height) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
let outputData;
|
|
116
|
+
if (options.outputPath) {
|
|
117
|
+
outputData = new Uint8Array(img1.data.length);
|
|
118
|
+
}
|
|
119
|
+
const startTime = performance.now();
|
|
120
|
+
const score = (0, import_msssim.default)(img1.data, img2.data, outputData, img1.width, img1.height, {});
|
|
121
|
+
const duration = performance.now() - startTime;
|
|
122
|
+
if (options.outputPath && outputData) {
|
|
123
|
+
await transformer.write(
|
|
124
|
+
{
|
|
125
|
+
data: outputData,
|
|
126
|
+
width: img1.width,
|
|
127
|
+
height: img1.height
|
|
128
|
+
},
|
|
129
|
+
options.outputPath
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const result = {
|
|
133
|
+
score,
|
|
134
|
+
width: img1.width,
|
|
135
|
+
height: img1.height,
|
|
136
|
+
duration
|
|
137
|
+
};
|
|
138
|
+
console.log(`completed in: ${result.duration.toFixed(2)}ms`);
|
|
139
|
+
console.log(`dimensions: ${result.width}x${result.height}`);
|
|
140
|
+
console.log(
|
|
141
|
+
`MS-SSIM score: ${result.score.toFixed(6)} (0=different, 1=identical)`
|
|
142
|
+
);
|
|
143
|
+
console.log(`similarity: ${(result.score * 100).toFixed(2)}%`);
|
|
144
|
+
if (options.outputPath && outputData) {
|
|
145
|
+
console.log(`MS-SSIM map saved to: ${options.outputPath}`);
|
|
146
|
+
}
|
|
147
|
+
if (result.score < 0.95) {
|
|
148
|
+
process.exit(1);
|
|
149
|
+
} else {
|
|
150
|
+
console.log(`Images are highly similar!`);
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error(
|
|
155
|
+
"Error:",
|
|
156
|
+
error instanceof Error ? error.message : String(error)
|
|
157
|
+
);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (typeof require !== "undefined" && require.main === module) {
|
|
162
|
+
main();
|
|
163
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/commands/ssim.ts
|
|
32
|
+
var ssim_exports = {};
|
|
33
|
+
__export(ssim_exports, {
|
|
34
|
+
default: () => main
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(ssim_exports);
|
|
37
|
+
var import_ssim = __toESM(require("@blazediff/ssim/ssim"));
|
|
38
|
+
function printUsage() {
|
|
39
|
+
console.log(`
|
|
40
|
+
Usage: blazediff ssim <image1> <image2> [options]
|
|
41
|
+
|
|
42
|
+
Arguments:
|
|
43
|
+
image1 Path to the first image
|
|
44
|
+
image2 Path to the second image
|
|
45
|
+
|
|
46
|
+
Options:
|
|
47
|
+
-o, --output <path> Output path for SSIM map visualization
|
|
48
|
+
--transformer <name> Specify transformer to use (e.g. pngjs, sharp)
|
|
49
|
+
-h, --help Show this help message
|
|
50
|
+
|
|
51
|
+
Examples:
|
|
52
|
+
blazediff ssim image1.png image2.png
|
|
53
|
+
blazediff ssim image1.png image2.png -o ssim-map.png
|
|
54
|
+
`);
|
|
55
|
+
}
|
|
56
|
+
var getTransformer = async (transformer) => {
|
|
57
|
+
if (!transformer || transformer === "pngjs") {
|
|
58
|
+
const { default: transformer2 } = await import("@blazediff/pngjs-transformer");
|
|
59
|
+
return transformer2;
|
|
60
|
+
}
|
|
61
|
+
if (transformer === "sharp") {
|
|
62
|
+
const { default: transformer2 } = await import("@blazediff/sharp-transformer");
|
|
63
|
+
return transformer2;
|
|
64
|
+
}
|
|
65
|
+
throw new Error(`Unknown transformer: ${transformer}`);
|
|
66
|
+
};
|
|
67
|
+
async function main() {
|
|
68
|
+
try {
|
|
69
|
+
const args = process.argv.slice(2);
|
|
70
|
+
if (args.length === 0 || args.includes("-h") || args.includes("--help")) {
|
|
71
|
+
printUsage();
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}
|
|
74
|
+
if (args.length < 2) {
|
|
75
|
+
console.error("Error: Two image paths are required");
|
|
76
|
+
printUsage();
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
const image1 = args[0];
|
|
80
|
+
const image2 = args[1];
|
|
81
|
+
const options = {};
|
|
82
|
+
for (let i = 2; i < args.length; i++) {
|
|
83
|
+
const arg = args[i];
|
|
84
|
+
const nextArg = args[i + 1];
|
|
85
|
+
switch (arg) {
|
|
86
|
+
case "-o":
|
|
87
|
+
case "--output":
|
|
88
|
+
if (nextArg) {
|
|
89
|
+
options.outputPath = nextArg;
|
|
90
|
+
i++;
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case "--transformer":
|
|
94
|
+
if (nextArg) {
|
|
95
|
+
options.transformer = nextArg;
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
console.error(`Unknown option: ${arg}`);
|
|
101
|
+
printUsage();
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
const transformer = await getTransformer(options.transformer);
|
|
106
|
+
const [img1, img2] = await Promise.all([
|
|
107
|
+
transformer.transform(image1),
|
|
108
|
+
transformer.transform(image2)
|
|
109
|
+
]);
|
|
110
|
+
if (img1.width !== img2.width || img1.height !== img2.height) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
`Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
let outputData;
|
|
116
|
+
if (options.outputPath) {
|
|
117
|
+
outputData = new Uint8Array(img1.data.length);
|
|
118
|
+
}
|
|
119
|
+
const startTime = performance.now();
|
|
120
|
+
const score = (0, import_ssim.default)(img1.data, img2.data, outputData, img1.width, img1.height, {});
|
|
121
|
+
const duration = performance.now() - startTime;
|
|
122
|
+
if (options.outputPath && outputData) {
|
|
123
|
+
await transformer.write(
|
|
124
|
+
{
|
|
125
|
+
data: outputData,
|
|
126
|
+
width: img1.width,
|
|
127
|
+
height: img1.height
|
|
128
|
+
},
|
|
129
|
+
options.outputPath
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const result = {
|
|
133
|
+
score,
|
|
134
|
+
width: img1.width,
|
|
135
|
+
height: img1.height,
|
|
136
|
+
duration
|
|
137
|
+
};
|
|
138
|
+
console.log(`completed in: ${result.duration.toFixed(2)}ms`);
|
|
139
|
+
console.log(`dimensions: ${result.width}x${result.height}`);
|
|
140
|
+
console.log(
|
|
141
|
+
`SSIM score: ${result.score.toFixed(6)} (0=different, 1=identical)`
|
|
142
|
+
);
|
|
143
|
+
console.log(`similarity: ${(result.score * 100).toFixed(2)}%`);
|
|
144
|
+
if (options.outputPath && outputData) {
|
|
145
|
+
console.log(`SSIM map saved to: ${options.outputPath}`);
|
|
146
|
+
}
|
|
147
|
+
if (result.score < 0.95) {
|
|
148
|
+
process.exit(1);
|
|
149
|
+
} else {
|
|
150
|
+
console.log(`Images are highly similar!`);
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error(
|
|
155
|
+
"Error:",
|
|
156
|
+
error instanceof Error ? error.message : String(error)
|
|
157
|
+
);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (typeof require !== "undefined" && require.main === module) {
|
|
162
|
+
main();
|
|
163
|
+
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { CoreOptions } from '@blazediff/core';
|
|
2
|
-
import { GmsdOptions } from '@blazediff/gmsd';
|
|
3
|
-
|
|
4
1
|
interface Image {
|
|
5
2
|
data: Buffer | Uint8Array | Uint8ClampedArray;
|
|
6
3
|
width: number;
|
|
@@ -10,18 +7,30 @@ interface Transformer {
|
|
|
10
7
|
transform: (input: string | Buffer) => Promise<Image>;
|
|
11
8
|
write: (image: Image, output: string | Buffer) => Promise<void>;
|
|
12
9
|
}
|
|
13
|
-
type ComparisonMode = "diff" | "gmsd";
|
|
10
|
+
type ComparisonMode = "diff" | "gmsd" | "ssim" | "msssim";
|
|
14
11
|
interface DiffModeOptions {
|
|
15
12
|
outputPath?: string;
|
|
16
13
|
transformer: Transformer;
|
|
17
14
|
mode?: "diff";
|
|
18
|
-
options?:
|
|
15
|
+
options?: Record<string, unknown>;
|
|
19
16
|
}
|
|
20
17
|
interface GmsdModeOptions {
|
|
21
18
|
outputPath?: string;
|
|
22
19
|
transformer: Transformer;
|
|
23
20
|
mode: "gmsd";
|
|
24
|
-
options?:
|
|
21
|
+
options?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface SsimModeOptions {
|
|
24
|
+
outputPath?: string;
|
|
25
|
+
transformer: Transformer;
|
|
26
|
+
mode: "ssim";
|
|
27
|
+
options?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
interface MsssimModeOptions {
|
|
30
|
+
outputPath?: string;
|
|
31
|
+
transformer: Transformer;
|
|
32
|
+
mode: "msssim";
|
|
33
|
+
options?: Record<string, unknown>;
|
|
25
34
|
}
|
|
26
35
|
interface DiffModeResult {
|
|
27
36
|
mode: "diff";
|
|
@@ -39,8 +48,22 @@ interface GmsdModeResult {
|
|
|
39
48
|
outputData?: Uint8Array;
|
|
40
49
|
duration: number;
|
|
41
50
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
interface SsimModeResult {
|
|
52
|
+
mode: "ssim";
|
|
53
|
+
score: number;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
outputData?: Uint8Array;
|
|
57
|
+
duration: number;
|
|
58
|
+
}
|
|
59
|
+
interface MsssimModeResult {
|
|
60
|
+
mode: "msssim";
|
|
61
|
+
score: number;
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
outputData?: Uint8Array;
|
|
65
|
+
duration: number;
|
|
66
|
+
}
|
|
67
|
+
type BlazeDiffBinResult = DiffModeResult | GmsdModeResult | SsimModeResult | MsssimModeResult;
|
|
45
68
|
|
|
46
|
-
export {
|
|
69
|
+
export type { BlazeDiffBinResult, ComparisonMode, DiffModeOptions, DiffModeResult, GmsdModeOptions, GmsdModeResult, Image, MsssimModeOptions, MsssimModeResult, SsimModeOptions, SsimModeResult, Transformer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { CoreOptions } from '@blazediff/core';
|
|
2
|
-
import { GmsdOptions } from '@blazediff/gmsd';
|
|
3
|
-
|
|
4
1
|
interface Image {
|
|
5
2
|
data: Buffer | Uint8Array | Uint8ClampedArray;
|
|
6
3
|
width: number;
|
|
@@ -10,18 +7,30 @@ interface Transformer {
|
|
|
10
7
|
transform: (input: string | Buffer) => Promise<Image>;
|
|
11
8
|
write: (image: Image, output: string | Buffer) => Promise<void>;
|
|
12
9
|
}
|
|
13
|
-
type ComparisonMode = "diff" | "gmsd";
|
|
10
|
+
type ComparisonMode = "diff" | "gmsd" | "ssim" | "msssim";
|
|
14
11
|
interface DiffModeOptions {
|
|
15
12
|
outputPath?: string;
|
|
16
13
|
transformer: Transformer;
|
|
17
14
|
mode?: "diff";
|
|
18
|
-
options?:
|
|
15
|
+
options?: Record<string, unknown>;
|
|
19
16
|
}
|
|
20
17
|
interface GmsdModeOptions {
|
|
21
18
|
outputPath?: string;
|
|
22
19
|
transformer: Transformer;
|
|
23
20
|
mode: "gmsd";
|
|
24
|
-
options?:
|
|
21
|
+
options?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
interface SsimModeOptions {
|
|
24
|
+
outputPath?: string;
|
|
25
|
+
transformer: Transformer;
|
|
26
|
+
mode: "ssim";
|
|
27
|
+
options?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
interface MsssimModeOptions {
|
|
30
|
+
outputPath?: string;
|
|
31
|
+
transformer: Transformer;
|
|
32
|
+
mode: "msssim";
|
|
33
|
+
options?: Record<string, unknown>;
|
|
25
34
|
}
|
|
26
35
|
interface DiffModeResult {
|
|
27
36
|
mode: "diff";
|
|
@@ -39,8 +48,22 @@ interface GmsdModeResult {
|
|
|
39
48
|
outputData?: Uint8Array;
|
|
40
49
|
duration: number;
|
|
41
50
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
interface SsimModeResult {
|
|
52
|
+
mode: "ssim";
|
|
53
|
+
score: number;
|
|
54
|
+
width: number;
|
|
55
|
+
height: number;
|
|
56
|
+
outputData?: Uint8Array;
|
|
57
|
+
duration: number;
|
|
58
|
+
}
|
|
59
|
+
interface MsssimModeResult {
|
|
60
|
+
mode: "msssim";
|
|
61
|
+
score: number;
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
outputData?: Uint8Array;
|
|
65
|
+
duration: number;
|
|
66
|
+
}
|
|
67
|
+
type BlazeDiffBinResult = DiffModeResult | GmsdModeResult | SsimModeResult | MsssimModeResult;
|
|
45
68
|
|
|
46
|
-
export {
|
|
69
|
+
export type { BlazeDiffBinResult, ComparisonMode, DiffModeOptions, DiffModeResult, GmsdModeOptions, GmsdModeResult, Image, MsssimModeOptions, MsssimModeResult, SsimModeOptions, SsimModeResult, Transformer };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';
|
package/dist/index.mjs
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import g from'@blazediff/core';import p from'@blazediff/gmsd';var w=n=>n.mode==="gmsd";async function c(n,d,e){let[t,i]=await Promise.all([e.transformer.transform(n),e.transformer.transform(d)]);if(t.width!==i.width||t.height!==i.height)throw new Error(`Image dimensions do not match: ${t.width}x${t.height} vs ${i.width}x${i.height}`);if(w(e)){let o;e.outputPath&&(o=new Uint8Array(t.data.length));let m=performance.now(),u=p(t.data,i.data,o,t.width,t.height,e.options||{}),h=performance.now()-m;return e.outputPath&&o&&await e.transformer.write({data:o,width:t.width,height:t.height},e.outputPath),{mode:"gmsd",width:t.width,height:t.height,outputData:o,duration:h,score:u}}let r;e.outputPath&&(r=new Uint8Array(t.data.length));let s=performance.now(),a=g(t.data,i.data,r,t.width,t.height,e.options||{}),f=performance.now()-s;return a>0&&e.outputPath&&r&&await e.transformer.write({data:r,width:t.width,height:t.height},e.outputPath),{mode:"diff",diffCount:a,width:t.width,height:t.height,outputData:r,duration:f}}export{c as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazediff/bin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Command-line interface for the blazediff image comparison library",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,10 +37,11 @@
|
|
|
37
37
|
"homepage": "https://blazediff.dev",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@blazediff/core": "1.
|
|
41
|
-
"@blazediff/gmsd": "1.
|
|
42
|
-
"@blazediff/pngjs-transformer": "1.
|
|
43
|
-
"@blazediff/sharp-transformer": "1.
|
|
40
|
+
"@blazediff/core": "1.6.0",
|
|
41
|
+
"@blazediff/gmsd": "1.6.0",
|
|
42
|
+
"@blazediff/pngjs-transformer": "1.6.0",
|
|
43
|
+
"@blazediff/sharp-transformer": "1.6.0",
|
|
44
|
+
"@blazediff/ssim": "1.6.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/node": "^24.3.0",
|