@blazediff/bin 0.4.0 → 0.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/dist/cli.js +18 -14
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -49,6 +49,16 @@ async function blazeDiffBin(image1Path, image2Path, options) {
|
|
|
49
49
|
options.coreOptions
|
|
50
50
|
);
|
|
51
51
|
const duration = performance.now() - startTime;
|
|
52
|
+
if (diffCount > 0 && options.outputPath && outputData) {
|
|
53
|
+
await options.transformer.write(
|
|
54
|
+
{
|
|
55
|
+
data: outputData,
|
|
56
|
+
width: image1.width,
|
|
57
|
+
height: image1.height
|
|
58
|
+
},
|
|
59
|
+
options.outputPath
|
|
60
|
+
);
|
|
61
|
+
}
|
|
52
62
|
return {
|
|
53
63
|
diffCount,
|
|
54
64
|
width: image1.width,
|
|
@@ -77,7 +87,7 @@ Options:
|
|
|
77
87
|
--include-aa Include anti-aliasing detection
|
|
78
88
|
--diff-mask Draw diff over transparent background
|
|
79
89
|
--transformer <name> Specify transformer to use (e.g. pngjs, sharp)
|
|
80
|
-
--
|
|
90
|
+
--color-space <name> Specify color space to use (e.g. yiq, ycbcr)
|
|
81
91
|
-h, --help Show this help message
|
|
82
92
|
|
|
83
93
|
Examples:
|
|
@@ -176,8 +186,11 @@ function parseArgs() {
|
|
|
176
186
|
i++;
|
|
177
187
|
}
|
|
178
188
|
break;
|
|
179
|
-
case "--
|
|
180
|
-
|
|
189
|
+
case "--colorSpace":
|
|
190
|
+
if (nextArg) {
|
|
191
|
+
options.colorSpace = nextArg;
|
|
192
|
+
i++;
|
|
193
|
+
}
|
|
181
194
|
break;
|
|
182
195
|
default:
|
|
183
196
|
console.error(`Unknown option: ${arg}`);
|
|
@@ -212,8 +225,7 @@ async function main() {
|
|
|
212
225
|
diffColor: options.diffColor,
|
|
213
226
|
diffColorAlt: options.diffColorAlt,
|
|
214
227
|
includeAA: options.includeAA,
|
|
215
|
-
diffMask: options.diffMask
|
|
216
|
-
yiq: options.yiq
|
|
228
|
+
diffMask: options.diffMask
|
|
217
229
|
}
|
|
218
230
|
});
|
|
219
231
|
console.log(`matched in: ${result.duration.toFixed(2)}ms`);
|
|
@@ -222,15 +234,7 @@ async function main() {
|
|
|
222
234
|
console.log(
|
|
223
235
|
`error: ${(result.diffCount / (result.width * result.height) * 100).toFixed(2)}%`
|
|
224
236
|
);
|
|
225
|
-
if (
|
|
226
|
-
await transformer.write(
|
|
227
|
-
{
|
|
228
|
-
data: result.outputData,
|
|
229
|
-
width: result.width,
|
|
230
|
-
height: result.height
|
|
231
|
-
},
|
|
232
|
-
options.outputPath
|
|
233
|
-
);
|
|
237
|
+
if (result.diffCount > 0 && result.outputData) {
|
|
234
238
|
console.log(`diff image: ${options.outputPath}`);
|
|
235
239
|
}
|
|
236
240
|
if (result.diffCount > 0) {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var m=require('@blazediff/core');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);async function u(n,f,i){let[t,e]=await Promise.all([i.transformer.transform(n),i.transformer.transform(f)]);if(t.width!==e.width||t.height!==e.height)throw new Error(`Image dimensions do not match: ${t.width}x${t.height} vs ${e.width}x${e.height}`);let r;i.outputPath&&(r=new Uint8Array(t.data.length));let h=performance.now(),a=m__default.default(t.data,e.data,r,t.width,t.height,i.coreOptions),o=performance.now()-h;return a>0&&i.outputPath&&r&&await i.transformer.write({data:r,width:t.width,height:t.height},i.outputPath),{diffCount:a,width:t.width,height:t.height,outputData:r,duration:o}}module.exports=u;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from'@blazediff/core';async function u(n,f,i){let[t,e]=await Promise.all([i.transformer.transform(n),i.transformer.transform(f)]);if(t.width!==e.width||t.height!==e.height)throw new Error(`Image dimensions do not match: ${t.width}x${t.height} vs ${e.width}x${e.height}`);let r;i.outputPath&&(r=new Uint8Array(t.data.length));let h=performance.now(),a=m(t.data,e.data,r,t.width,t.height,i.coreOptions),o=performance.now()-h;return a>0&&i.outputPath&&r&&await i.transformer.write({data:r,width:t.width,height:t.height},i.outputPath),{diffCount:a,width:t.width,height:t.height,outputData:r,duration:o}}export{u as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazediff/bin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Command-line interface for the blazediff image comparison library",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"homepage": "https://github.com/teimurjan/blazediff",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@blazediff/core": "0.
|
|
41
|
-
"@blazediff/pngjs-transformer": "0.
|
|
42
|
-
"@blazediff/sharp-transformer": "0.
|
|
40
|
+
"@blazediff/core": "0.6.0",
|
|
41
|
+
"@blazediff/pngjs-transformer": "0.6.0",
|
|
42
|
+
"@blazediff/sharp-transformer": "0.6.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^24.3.0",
|
|
46
46
|
"tsup": "8.5.0",
|
|
47
47
|
"typescript": "5.9.2",
|
|
48
|
-
"@blazediff/types": "0.
|
|
48
|
+
"@blazediff/types": "0.6.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup",
|