@blazediff/cli 5.0.5 → 6.0.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 +23 -22
- package/dist/cli.js +1546 -1284
- package/dist/commands/core-native.js +9341 -89
- package/dist/commands/core-wasm.js +147 -126
- package/dist/commands/core.js +751 -457
- package/dist/commands/gmsd.js +178 -175
- package/dist/commands/hitchhikers-ssim.js +172 -152
- package/dist/commands/msssim.js +163 -146
- package/dist/commands/ssim.js +264 -250
- package/package.json +8 -8
package/dist/commands/gmsd.js
CHANGED
|
@@ -2125,7 +2125,7 @@ var require_png = __commonJS({
|
|
|
2125
2125
|
// ../codec-pngjs/dist/index.mjs
|
|
2126
2126
|
var dist_exports = {};
|
|
2127
2127
|
__export(dist_exports, {
|
|
2128
|
-
codecPngjs: () =>
|
|
2128
|
+
codecPngjs: () => w2,
|
|
2129
2129
|
default: () => g
|
|
2130
2130
|
});
|
|
2131
2131
|
function h(e) {
|
|
@@ -2161,15 +2161,15 @@ async function c(e, r) {
|
|
|
2161
2161
|
}
|
|
2162
2162
|
});
|
|
2163
2163
|
}
|
|
2164
|
-
var import_fs, import_pngjs, d,
|
|
2164
|
+
var import_fs, import_pngjs, d, w2, g;
|
|
2165
2165
|
var init_dist = __esm({
|
|
2166
2166
|
"../codec-pngjs/dist/index.mjs"() {
|
|
2167
2167
|
"use strict";
|
|
2168
2168
|
import_fs = require("fs");
|
|
2169
2169
|
import_pngjs = __toESM(require_png(), 1);
|
|
2170
2170
|
d = typeof globalThis.Deno < "u";
|
|
2171
|
-
|
|
2172
|
-
g =
|
|
2171
|
+
w2 = { read: s, write: c };
|
|
2172
|
+
g = w2;
|
|
2173
2173
|
}
|
|
2174
2174
|
});
|
|
2175
2175
|
|
|
@@ -2645,7 +2645,7 @@ var require_re = __commonJS({
|
|
|
2645
2645
|
var src = exports2.src = [];
|
|
2646
2646
|
var safeSrc = exports2.safeSrc = [];
|
|
2647
2647
|
var t = exports2.t = {};
|
|
2648
|
-
var
|
|
2648
|
+
var R2 = 0;
|
|
2649
2649
|
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
2650
2650
|
var safeRegexReplacements = [
|
|
2651
2651
|
["\\s", 1],
|
|
@@ -2660,7 +2660,7 @@ var require_re = __commonJS({
|
|
|
2660
2660
|
};
|
|
2661
2661
|
var createToken = (name, value, isGlobal) => {
|
|
2662
2662
|
const safe = makeSafeRegex(value);
|
|
2663
|
-
const index =
|
|
2663
|
+
const index = R2++;
|
|
2664
2664
|
debug(name, index, value);
|
|
2665
2665
|
t[name] = index;
|
|
2666
2666
|
src[index] = value;
|
|
@@ -3432,11 +3432,11 @@ var require_range = __commonJS({
|
|
|
3432
3432
|
this.formatted += "||";
|
|
3433
3433
|
}
|
|
3434
3434
|
const comps = this.set[i3];
|
|
3435
|
-
for (let
|
|
3436
|
-
if (
|
|
3435
|
+
for (let k2 = 0; k2 < comps.length; k2++) {
|
|
3436
|
+
if (k2 > 0) {
|
|
3437
3437
|
this.formatted += " ";
|
|
3438
3438
|
}
|
|
3439
|
-
this.formatted += comps[
|
|
3439
|
+
this.formatted += comps[k2].toString().trim();
|
|
3440
3440
|
}
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
@@ -3570,20 +3570,20 @@ var require_range = __commonJS({
|
|
|
3570
3570
|
};
|
|
3571
3571
|
var replaceTilde = (comp, options) => {
|
|
3572
3572
|
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
3573
|
-
return comp.replace(r, (_,
|
|
3574
|
-
debug("tilde", comp, _,
|
|
3573
|
+
return comp.replace(r, (_, M2, m2, p2, pr) => {
|
|
3574
|
+
debug("tilde", comp, _, M2, m2, p2, pr);
|
|
3575
3575
|
let ret;
|
|
3576
|
-
if (isX(
|
|
3576
|
+
if (isX(M2)) {
|
|
3577
3577
|
ret = "";
|
|
3578
3578
|
} else if (isX(m2)) {
|
|
3579
|
-
ret = `>=${
|
|
3579
|
+
ret = `>=${M2}.0.0 <${+M2 + 1}.0.0-0`;
|
|
3580
3580
|
} else if (isX(p2)) {
|
|
3581
|
-
ret = `>=${
|
|
3581
|
+
ret = `>=${M2}.${m2}.0 <${M2}.${+m2 + 1}.0-0`;
|
|
3582
3582
|
} else if (pr) {
|
|
3583
3583
|
debug("replaceTilde pr", pr);
|
|
3584
|
-
ret = `>=${
|
|
3584
|
+
ret = `>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2 + 1}.0-0`;
|
|
3585
3585
|
} else {
|
|
3586
|
-
ret = `>=${
|
|
3586
|
+
ret = `>=${M2}.${m2}.${p2} <${M2}.${+m2 + 1}.0-0`;
|
|
3587
3587
|
}
|
|
3588
3588
|
debug("tilde return", ret);
|
|
3589
3589
|
return ret;
|
|
@@ -3595,41 +3595,41 @@ var require_range = __commonJS({
|
|
|
3595
3595
|
var replaceCaret = (comp, options) => {
|
|
3596
3596
|
debug("caret", comp, options);
|
|
3597
3597
|
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
3598
|
-
const
|
|
3599
|
-
return comp.replace(r, (_,
|
|
3600
|
-
debug("caret", comp, _,
|
|
3598
|
+
const z2 = options.includePrerelease ? "-0" : "";
|
|
3599
|
+
return comp.replace(r, (_, M2, m2, p2, pr) => {
|
|
3600
|
+
debug("caret", comp, _, M2, m2, p2, pr);
|
|
3601
3601
|
let ret;
|
|
3602
|
-
if (isX(
|
|
3602
|
+
if (isX(M2)) {
|
|
3603
3603
|
ret = "";
|
|
3604
3604
|
} else if (isX(m2)) {
|
|
3605
|
-
ret = `>=${
|
|
3605
|
+
ret = `>=${M2}.0.0${z2} <${+M2 + 1}.0.0-0`;
|
|
3606
3606
|
} else if (isX(p2)) {
|
|
3607
|
-
if (
|
|
3608
|
-
ret = `>=${
|
|
3607
|
+
if (M2 === "0") {
|
|
3608
|
+
ret = `>=${M2}.${m2}.0${z2} <${M2}.${+m2 + 1}.0-0`;
|
|
3609
3609
|
} else {
|
|
3610
|
-
ret = `>=${
|
|
3610
|
+
ret = `>=${M2}.${m2}.0${z2} <${+M2 + 1}.0.0-0`;
|
|
3611
3611
|
}
|
|
3612
3612
|
} else if (pr) {
|
|
3613
3613
|
debug("replaceCaret pr", pr);
|
|
3614
|
-
if (
|
|
3614
|
+
if (M2 === "0") {
|
|
3615
3615
|
if (m2 === "0") {
|
|
3616
|
-
ret = `>=${
|
|
3616
|
+
ret = `>=${M2}.${m2}.${p2}-${pr} <${M2}.${m2}.${+p2 + 1}-0`;
|
|
3617
3617
|
} else {
|
|
3618
|
-
ret = `>=${
|
|
3618
|
+
ret = `>=${M2}.${m2}.${p2}-${pr} <${M2}.${+m2 + 1}.0-0`;
|
|
3619
3619
|
}
|
|
3620
3620
|
} else {
|
|
3621
|
-
ret = `>=${
|
|
3621
|
+
ret = `>=${M2}.${m2}.${p2}-${pr} <${+M2 + 1}.0.0-0`;
|
|
3622
3622
|
}
|
|
3623
3623
|
} else {
|
|
3624
3624
|
debug("no pr");
|
|
3625
|
-
if (
|
|
3625
|
+
if (M2 === "0") {
|
|
3626
3626
|
if (m2 === "0") {
|
|
3627
|
-
ret = `>=${
|
|
3627
|
+
ret = `>=${M2}.${m2}.${p2}${z2} <${M2}.${m2}.${+p2 + 1}-0`;
|
|
3628
3628
|
} else {
|
|
3629
|
-
ret = `>=${
|
|
3629
|
+
ret = `>=${M2}.${m2}.${p2}${z2} <${M2}.${+m2 + 1}.0-0`;
|
|
3630
3630
|
}
|
|
3631
3631
|
} else {
|
|
3632
|
-
ret = `>=${
|
|
3632
|
+
ret = `>=${M2}.${m2}.${p2} <${+M2 + 1}.0.0-0`;
|
|
3633
3633
|
}
|
|
3634
3634
|
}
|
|
3635
3635
|
debug("caret return", ret);
|
|
@@ -3643,9 +3643,9 @@ var require_range = __commonJS({
|
|
|
3643
3643
|
var replaceXRange = (comp, options) => {
|
|
3644
3644
|
comp = comp.trim();
|
|
3645
3645
|
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
3646
|
-
return comp.replace(r, (ret, gtlt,
|
|
3647
|
-
debug("xRange", comp, ret, gtlt,
|
|
3648
|
-
const xM = isX(
|
|
3646
|
+
return comp.replace(r, (ret, gtlt, M2, m2, p2, pr) => {
|
|
3647
|
+
debug("xRange", comp, ret, gtlt, M2, m2, p2, pr);
|
|
3648
|
+
const xM = isX(M2);
|
|
3649
3649
|
const xm = xM || isX(m2);
|
|
3650
3650
|
const xp = xm || isX(p2);
|
|
3651
3651
|
const anyX = xp;
|
|
@@ -3667,7 +3667,7 @@ var require_range = __commonJS({
|
|
|
3667
3667
|
if (gtlt === ">") {
|
|
3668
3668
|
gtlt = ">=";
|
|
3669
3669
|
if (xm) {
|
|
3670
|
-
|
|
3670
|
+
M2 = +M2 + 1;
|
|
3671
3671
|
m2 = 0;
|
|
3672
3672
|
p2 = 0;
|
|
3673
3673
|
} else {
|
|
@@ -3677,7 +3677,7 @@ var require_range = __commonJS({
|
|
|
3677
3677
|
} else if (gtlt === "<=") {
|
|
3678
3678
|
gtlt = "<";
|
|
3679
3679
|
if (xm) {
|
|
3680
|
-
|
|
3680
|
+
M2 = +M2 + 1;
|
|
3681
3681
|
} else {
|
|
3682
3682
|
m2 = +m2 + 1;
|
|
3683
3683
|
}
|
|
@@ -3685,11 +3685,11 @@ var require_range = __commonJS({
|
|
|
3685
3685
|
if (gtlt === "<") {
|
|
3686
3686
|
pr = "-0";
|
|
3687
3687
|
}
|
|
3688
|
-
ret = `${gtlt +
|
|
3688
|
+
ret = `${gtlt + M2}.${m2}.${p2}${pr}`;
|
|
3689
3689
|
} else if (xm) {
|
|
3690
|
-
ret = `>=${
|
|
3690
|
+
ret = `>=${M2}.0.0${pr} <${+M2 + 1}.0.0-0`;
|
|
3691
3691
|
} else if (xp) {
|
|
3692
|
-
ret = `>=${
|
|
3692
|
+
ret = `>=${M2}.${m2}.0${pr} <${M2}.${+m2 + 1}.0-0`;
|
|
3693
3693
|
}
|
|
3694
3694
|
debug("xRange return", ret);
|
|
3695
3695
|
return ret;
|
|
@@ -6272,10 +6272,10 @@ var require_color = __commonJS({
|
|
|
6272
6272
|
if (match) {
|
|
6273
6273
|
const alpha = Number.parseFloat(match[4]);
|
|
6274
6274
|
const h4 = (Number.parseFloat(match[1]) % 360 + 360) % 360;
|
|
6275
|
-
const
|
|
6275
|
+
const w4 = clamp(Number.parseFloat(match[2]), 0, 100);
|
|
6276
6276
|
const b = clamp(Number.parseFloat(match[3]), 0, 100);
|
|
6277
6277
|
const a2 = clamp(Number.isNaN(alpha) ? 1 : alpha, 0, 1);
|
|
6278
|
-
return [h4,
|
|
6278
|
+
return [h4, w4, b, a2];
|
|
6279
6279
|
}
|
|
6280
6280
|
return null;
|
|
6281
6281
|
};
|
|
@@ -6454,9 +6454,9 @@ var require_color = __commonJS({
|
|
|
6454
6454
|
const g2 = rgb[1];
|
|
6455
6455
|
let b = rgb[2];
|
|
6456
6456
|
const h4 = convert.rgb.hsl(rgb)[0];
|
|
6457
|
-
const
|
|
6457
|
+
const w4 = 1 / 255 * Math.min(r, Math.min(g2, b));
|
|
6458
6458
|
b = 1 - 1 / 255 * Math.max(r, Math.max(g2, b));
|
|
6459
|
-
return [h4,
|
|
6459
|
+
return [h4, w4 * 100, b * 100];
|
|
6460
6460
|
};
|
|
6461
6461
|
convert.rgb.oklab = function(rgb) {
|
|
6462
6462
|
const r = srgbNonlinearTransformInv(rgb[0] / 255);
|
|
@@ -6474,11 +6474,11 @@ var require_color = __commonJS({
|
|
|
6474
6474
|
const r = rgb[0] / 255;
|
|
6475
6475
|
const g2 = rgb[1] / 255;
|
|
6476
6476
|
const b = rgb[2] / 255;
|
|
6477
|
-
const
|
|
6478
|
-
const c3 = (1 - r -
|
|
6479
|
-
const m2 = (1 - g2 -
|
|
6480
|
-
const y = (1 - b -
|
|
6481
|
-
return [c3 * 100, m2 * 100, y * 100,
|
|
6477
|
+
const k2 = Math.min(1 - r, 1 - g2, 1 - b);
|
|
6478
|
+
const c3 = (1 - r - k2) / (1 - k2) || 0;
|
|
6479
|
+
const m2 = (1 - g2 - k2) / (1 - k2) || 0;
|
|
6480
|
+
const y = (1 - b - k2) / (1 - k2) || 0;
|
|
6481
|
+
return [c3 * 100, m2 * 100, y * 100, k2 * 100];
|
|
6482
6482
|
};
|
|
6483
6483
|
function comparativeDistance(x, y) {
|
|
6484
6484
|
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
@@ -6509,23 +6509,23 @@ var require_color = __commonJS({
|
|
|
6509
6509
|
const b = srgbNonlinearTransformInv(rgb[2] / 255);
|
|
6510
6510
|
const x = r * 0.4124564 + g2 * 0.3575761 + b * 0.1804375;
|
|
6511
6511
|
const y = r * 0.2126729 + g2 * 0.7151522 + b * 0.072175;
|
|
6512
|
-
const
|
|
6513
|
-
return [x * 100, y * 100,
|
|
6512
|
+
const z2 = r * 0.0193339 + g2 * 0.119192 + b * 0.9503041;
|
|
6513
|
+
return [x * 100, y * 100, z2 * 100];
|
|
6514
6514
|
};
|
|
6515
6515
|
convert.rgb.lab = function(rgb) {
|
|
6516
6516
|
const xyz = convert.rgb.xyz(rgb);
|
|
6517
6517
|
let x = xyz[0];
|
|
6518
6518
|
let y = xyz[1];
|
|
6519
|
-
let
|
|
6519
|
+
let z2 = xyz[2];
|
|
6520
6520
|
x /= 95.047;
|
|
6521
6521
|
y /= 100;
|
|
6522
|
-
|
|
6522
|
+
z2 /= 108.883;
|
|
6523
6523
|
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6524
6524
|
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6525
|
-
|
|
6525
|
+
z2 = z2 > LAB_FT ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
|
|
6526
6526
|
const l = 116 * y - 16;
|
|
6527
6527
|
const a2 = 500 * (x - y);
|
|
6528
|
-
const b = 200 * (y -
|
|
6528
|
+
const b = 200 * (y - z2);
|
|
6529
6529
|
return [l, a2, b];
|
|
6530
6530
|
};
|
|
6531
6531
|
convert.hsl.rgb = function(hsl) {
|
|
@@ -6687,22 +6687,22 @@ var require_color = __commonJS({
|
|
|
6687
6687
|
const c3 = cmyk[0] / 100;
|
|
6688
6688
|
const m2 = cmyk[1] / 100;
|
|
6689
6689
|
const y = cmyk[2] / 100;
|
|
6690
|
-
const
|
|
6691
|
-
const r = 1 - Math.min(1, c3 * (1 -
|
|
6692
|
-
const g2 = 1 - Math.min(1, m2 * (1 -
|
|
6693
|
-
const b = 1 - Math.min(1, y * (1 -
|
|
6690
|
+
const k2 = cmyk[3] / 100;
|
|
6691
|
+
const r = 1 - Math.min(1, c3 * (1 - k2) + k2);
|
|
6692
|
+
const g2 = 1 - Math.min(1, m2 * (1 - k2) + k2);
|
|
6693
|
+
const b = 1 - Math.min(1, y * (1 - k2) + k2);
|
|
6694
6694
|
return [r * 255, g2 * 255, b * 255];
|
|
6695
6695
|
};
|
|
6696
6696
|
convert.xyz.rgb = function(xyz) {
|
|
6697
6697
|
const x = xyz[0] / 100;
|
|
6698
6698
|
const y = xyz[1] / 100;
|
|
6699
|
-
const
|
|
6699
|
+
const z2 = xyz[2] / 100;
|
|
6700
6700
|
let r;
|
|
6701
6701
|
let g2;
|
|
6702
6702
|
let b;
|
|
6703
|
-
r = x * 3.2404542 + y * -1.5371385 +
|
|
6704
|
-
g2 = x * -0.969266 + y * 1.8760108 +
|
|
6705
|
-
b = x * 0.0556434 + y * -0.2040259 +
|
|
6703
|
+
r = x * 3.2404542 + y * -1.5371385 + z2 * -0.4985314;
|
|
6704
|
+
g2 = x * -0.969266 + y * 1.8760108 + z2 * 0.041556;
|
|
6705
|
+
b = x * 0.0556434 + y * -0.2040259 + z2 * 1.0572252;
|
|
6706
6706
|
r = srgbNonlinearTransform(r);
|
|
6707
6707
|
g2 = srgbNonlinearTransform(g2);
|
|
6708
6708
|
b = srgbNonlinearTransform(b);
|
|
@@ -6711,25 +6711,25 @@ var require_color = __commonJS({
|
|
|
6711
6711
|
convert.xyz.lab = function(xyz) {
|
|
6712
6712
|
let x = xyz[0];
|
|
6713
6713
|
let y = xyz[1];
|
|
6714
|
-
let
|
|
6714
|
+
let z2 = xyz[2];
|
|
6715
6715
|
x /= 95.047;
|
|
6716
6716
|
y /= 100;
|
|
6717
|
-
|
|
6717
|
+
z2 /= 108.883;
|
|
6718
6718
|
x = x > LAB_FT ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
6719
6719
|
y = y > LAB_FT ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
6720
|
-
|
|
6720
|
+
z2 = z2 > LAB_FT ? z2 ** (1 / 3) : 7.787 * z2 + 16 / 116;
|
|
6721
6721
|
const l = 116 * y - 16;
|
|
6722
6722
|
const a2 = 500 * (x - y);
|
|
6723
|
-
const b = 200 * (y -
|
|
6723
|
+
const b = 200 * (y - z2);
|
|
6724
6724
|
return [l, a2, b];
|
|
6725
6725
|
};
|
|
6726
6726
|
convert.xyz.oklab = function(xyz) {
|
|
6727
6727
|
const x = xyz[0] / 100;
|
|
6728
6728
|
const y = xyz[1] / 100;
|
|
6729
|
-
const
|
|
6730
|
-
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 *
|
|
6731
|
-
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 *
|
|
6732
|
-
const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 *
|
|
6729
|
+
const z2 = xyz[2] / 100;
|
|
6730
|
+
const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z2);
|
|
6731
|
+
const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z2);
|
|
6732
|
+
const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z2);
|
|
6733
6733
|
const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
|
|
6734
6734
|
const a2 = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
|
|
6735
6735
|
const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
|
|
@@ -6747,8 +6747,8 @@ var require_color = __commonJS({
|
|
|
6747
6747
|
const s2 = (1.000000055 * ll - 0.089484182 * a2 - 1.291485538 * b) ** 3;
|
|
6748
6748
|
const x = 1.227013851 * l - 0.55779998 * m2 + 0.281256149 * s2;
|
|
6749
6749
|
const y = -0.040580178 * l + 1.11225687 * m2 - 0.071676679 * s2;
|
|
6750
|
-
const
|
|
6751
|
-
return [x * 100, y * 100,
|
|
6750
|
+
const z2 = -0.076381285 * l - 0.421481978 * m2 + 1.58616322 * s2;
|
|
6751
|
+
return [x * 100, y * 100, z2 * 100];
|
|
6752
6752
|
};
|
|
6753
6753
|
convert.oklab.rgb = function(oklab) {
|
|
6754
6754
|
const ll = oklab[0] / 100;
|
|
@@ -6771,20 +6771,20 @@ var require_color = __commonJS({
|
|
|
6771
6771
|
const b = lab[2];
|
|
6772
6772
|
let x;
|
|
6773
6773
|
let y;
|
|
6774
|
-
let
|
|
6774
|
+
let z2;
|
|
6775
6775
|
y = (l + 16) / 116;
|
|
6776
6776
|
x = a2 / 500 + y;
|
|
6777
|
-
|
|
6777
|
+
z2 = y - b / 200;
|
|
6778
6778
|
const y2 = y ** 3;
|
|
6779
6779
|
const x2 = x ** 3;
|
|
6780
|
-
const
|
|
6780
|
+
const z22 = z2 ** 3;
|
|
6781
6781
|
y = y2 > LAB_FT ? y2 : (y - 16 / 116) / 7.787;
|
|
6782
6782
|
x = x2 > LAB_FT ? x2 : (x - 16 / 116) / 7.787;
|
|
6783
|
-
|
|
6783
|
+
z2 = z22 > LAB_FT ? z22 : (z2 - 16 / 116) / 7.787;
|
|
6784
6784
|
x *= 95.047;
|
|
6785
6785
|
y *= 100;
|
|
6786
|
-
|
|
6787
|
-
return [x, y,
|
|
6786
|
+
z2 *= 108.883;
|
|
6787
|
+
return [x, y, z2];
|
|
6788
6788
|
};
|
|
6789
6789
|
convert.lab.lch = function(lab) {
|
|
6790
6790
|
const l = lab[0];
|
|
@@ -6941,7 +6941,7 @@ var require_color = __commonJS({
|
|
|
6941
6941
|
const pure = [0, 0, 0];
|
|
6942
6942
|
const hi = h4 % 1 * 6;
|
|
6943
6943
|
const v = hi % 1;
|
|
6944
|
-
const
|
|
6944
|
+
const w4 = 1 - v;
|
|
6945
6945
|
let mg = 0;
|
|
6946
6946
|
switch (Math.floor(hi)) {
|
|
6947
6947
|
case 0: {
|
|
@@ -6951,7 +6951,7 @@ var require_color = __commonJS({
|
|
|
6951
6951
|
break;
|
|
6952
6952
|
}
|
|
6953
6953
|
case 1: {
|
|
6954
|
-
pure[0] =
|
|
6954
|
+
pure[0] = w4;
|
|
6955
6955
|
pure[1] = 1;
|
|
6956
6956
|
pure[2] = 0;
|
|
6957
6957
|
break;
|
|
@@ -6964,7 +6964,7 @@ var require_color = __commonJS({
|
|
|
6964
6964
|
}
|
|
6965
6965
|
case 3: {
|
|
6966
6966
|
pure[0] = 0;
|
|
6967
|
-
pure[1] =
|
|
6967
|
+
pure[1] = w4;
|
|
6968
6968
|
pure[2] = 1;
|
|
6969
6969
|
break;
|
|
6970
6970
|
}
|
|
@@ -6977,7 +6977,7 @@ var require_color = __commonJS({
|
|
|
6977
6977
|
default: {
|
|
6978
6978
|
pure[0] = 1;
|
|
6979
6979
|
pure[1] = 0;
|
|
6980
|
-
pure[2] =
|
|
6980
|
+
pure[2] = w4;
|
|
6981
6981
|
}
|
|
6982
6982
|
}
|
|
6983
6983
|
mg = (1 - c3) * g2;
|
|
@@ -7016,10 +7016,10 @@ var require_color = __commonJS({
|
|
|
7016
7016
|
return [hcg[0], (v - c3) * 100, (1 - v) * 100];
|
|
7017
7017
|
};
|
|
7018
7018
|
convert.hwb.hcg = function(hwb) {
|
|
7019
|
-
const
|
|
7019
|
+
const w4 = hwb[1] / 100;
|
|
7020
7020
|
const b = hwb[2] / 100;
|
|
7021
7021
|
const v = 1 - b;
|
|
7022
|
-
const c3 = v -
|
|
7022
|
+
const c3 = v - w4;
|
|
7023
7023
|
let g2 = 0;
|
|
7024
7024
|
if (c3 < 1) {
|
|
7025
7025
|
g2 = (v - c3) / (1 - c3);
|
|
@@ -7472,9 +7472,9 @@ var require_color = __commonJS({
|
|
|
7472
7472
|
const color1 = mixinColor.rgb();
|
|
7473
7473
|
const color2 = this.rgb();
|
|
7474
7474
|
const p2 = weight === void 0 ? 0.5 : weight;
|
|
7475
|
-
const
|
|
7475
|
+
const w4 = 2 * p2 - 1;
|
|
7476
7476
|
const a2 = color1.alpha() - color2.alpha();
|
|
7477
|
-
const w1 = ((
|
|
7477
|
+
const w1 = ((w4 * a2 === -1 ? w4 : (w4 + a2) / (1 + w4 * a2)) + 1) / 2;
|
|
7478
7478
|
const w22 = 1 - w1;
|
|
7479
7479
|
return Color.rgb(
|
|
7480
7480
|
w1 * color1.red() + w22 * color2.red(),
|
|
@@ -7788,11 +7788,11 @@ var require_output = __commonJS({
|
|
|
7788
7788
|
if (is.object(exif)) {
|
|
7789
7789
|
for (const [ifd, entries] of Object.entries(exif)) {
|
|
7790
7790
|
if (is.object(entries)) {
|
|
7791
|
-
for (const [
|
|
7791
|
+
for (const [k2, v] of Object.entries(entries)) {
|
|
7792
7792
|
if (is.string(v)) {
|
|
7793
|
-
this.options.withExif[`exif-${ifd.toLowerCase()}-${
|
|
7793
|
+
this.options.withExif[`exif-${ifd.toLowerCase()}-${k2}`] = v;
|
|
7794
7794
|
} else {
|
|
7795
|
-
throw is.invalidParameterError(`${ifd}.${
|
|
7795
|
+
throw is.invalidParameterError(`${ifd}.${k2}`, "string", v);
|
|
7796
7796
|
}
|
|
7797
7797
|
}
|
|
7798
7798
|
} else {
|
|
@@ -9086,7 +9086,7 @@ var init_encode = __esm({
|
|
|
9086
9086
|
// ../codec-jsquash-png/dist/index.mjs
|
|
9087
9087
|
var dist_exports3 = {};
|
|
9088
9088
|
__export(dist_exports3, {
|
|
9089
|
-
codecJsquashPng: () =>
|
|
9089
|
+
codecJsquashPng: () => w3,
|
|
9090
9090
|
default: () => p
|
|
9091
9091
|
});
|
|
9092
9092
|
function c2() {
|
|
@@ -9111,7 +9111,7 @@ async function m(e, a2) {
|
|
|
9111
9111
|
throw new Error(`Failed to write PNG file ${a2}: ${t}`);
|
|
9112
9112
|
}
|
|
9113
9113
|
}
|
|
9114
|
-
var import_fs2, import_path, i2, o2,
|
|
9114
|
+
var import_fs2, import_path, i2, o2, w3, p;
|
|
9115
9115
|
var init_dist3 = __esm({
|
|
9116
9116
|
"../codec-jsquash-png/dist/index.mjs"() {
|
|
9117
9117
|
"use strict";
|
|
@@ -9122,8 +9122,8 @@ var init_dist3 = __esm({
|
|
|
9122
9122
|
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
9123
9123
|
});
|
|
9124
9124
|
o2 = null;
|
|
9125
|
-
|
|
9126
|
-
p =
|
|
9125
|
+
w3 = { read: h3, write: m };
|
|
9126
|
+
p = w3;
|
|
9127
9127
|
}
|
|
9128
9128
|
});
|
|
9129
9129
|
|
|
@@ -9135,89 +9135,92 @@ __export(gmsd_exports, {
|
|
|
9135
9135
|
module.exports = __toCommonJS(gmsd_exports);
|
|
9136
9136
|
|
|
9137
9137
|
// ../gmsd/dist/index.mjs
|
|
9138
|
-
function
|
|
9139
|
-
|
|
9140
|
-
if (
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
let
|
|
9145
|
-
if (
|
|
9146
|
-
|
|
9147
|
-
|
|
9148
|
-
|
|
9149
|
-
|
|
9150
|
-
|
|
9151
|
-
|
|
9152
|
-
|
|
9153
|
-
|
|
9154
|
-
|
|
9155
|
-
|
|
9156
|
-
|
|
9138
|
+
function G(t, r, n2 = {}) {
|
|
9139
|
+
if (w(t, "a"), w(r, "b"), t.width !== r.width || t.height !== r.height) return { kind: "dimension-mismatch", a: { width: t.width, height: t.height }, b: { width: r.width, height: r.height } };
|
|
9140
|
+
if (n2.output && (w(n2.output, "output"), n2.output.width !== t.width || n2.output.height !== t.height)) throw new RangeError(`output is ${n2.output.width}x${n2.output.height}, expected ${t.width}x${t.height}.`);
|
|
9141
|
+
return { kind: "compared", score: k(t, r, n2) };
|
|
9142
|
+
}
|
|
9143
|
+
function w(t, r) {
|
|
9144
|
+
let { data: n2, width: s2, height: o3 } = t ?? {};
|
|
9145
|
+
if (!ArrayBuffer.isView(n2) || n2.BYTES_PER_ELEMENT !== 1) throw new TypeError(`${r}.data must be a Uint8Array, Uint8ClampedArray or Buffer.`);
|
|
9146
|
+
if (!Number.isInteger(s2) || !Number.isInteger(o3) || s2 < 1 || o3 < 1) throw new RangeError(`${r} has an invalid size: ${s2}x${o3}.`);
|
|
9147
|
+
if (n2.length !== s2 * o3 * 4) throw new RangeError(`${r}.data is ${n2.length} bytes, expected ${s2 * o3 * 4} for ${s2}x${o3}.`);
|
|
9148
|
+
}
|
|
9149
|
+
function k(t, r, n2) {
|
|
9150
|
+
let { downsample: s2 = 0, c: o3 = 170 } = n2, { width: e, height: a2 } = t, i3 = n2.output?.data;
|
|
9151
|
+
if (R(t.data, r.data)) return i3?.fill(255), 0;
|
|
9152
|
+
let l = new Float32Array(e * a2), c3 = new Float32Array(e * a2), m2 = e, u = a2;
|
|
9153
|
+
if (M(t.data, l, e, a2), M(r.data, c3, e, a2), s2 === 1) {
|
|
9154
|
+
let b = E(l, e, a2), v = E(c3, e, a2), y = Math.floor(e / 2), A = Math.floor(a2 / 2), F = new Float32Array(y * A), I = new Float32Array(y * A);
|
|
9155
|
+
for (let p2 = 0; p2 < A; p2++) for (let x = 0; x < y; x++) {
|
|
9156
|
+
let $ = p2 * 2 * e + x * 2;
|
|
9157
|
+
F[p2 * y + x] = b[$], I[p2 * y + x] = v[$];
|
|
9158
|
+
}
|
|
9159
|
+
l = F, c3 = I, m2 = y, u = A;
|
|
9157
9160
|
}
|
|
9158
|
-
let
|
|
9159
|
-
return
|
|
9161
|
+
let d2 = S(l, m2, u), h4 = S(c3, m2, u), g2 = z(d2, h4, o3, m2, u), f = T(g2);
|
|
9162
|
+
return i3 && U(i3, d2, h4, o3, m2, u), f;
|
|
9160
9163
|
}
|
|
9161
|
-
function
|
|
9162
|
-
if (
|
|
9163
|
-
for (let
|
|
9164
|
+
function R(t, r) {
|
|
9165
|
+
if (t.length !== r.length) return false;
|
|
9166
|
+
for (let n2 = 0; n2 < t.length; n2++) if (t[n2] !== r[n2]) return false;
|
|
9164
9167
|
return true;
|
|
9165
9168
|
}
|
|
9166
|
-
function
|
|
9167
|
-
let
|
|
9168
|
-
for (let
|
|
9169
|
-
let
|
|
9170
|
-
for (let
|
|
9171
|
-
let
|
|
9172
|
-
|
|
9173
|
-
}
|
|
9174
|
-
|
|
9169
|
+
function E(t, r, n2) {
|
|
9170
|
+
let s2 = new Float32Array(r * n2);
|
|
9171
|
+
for (let o3 = 0; o3 < n2; o3++) for (let e = 0; e < r; e++) {
|
|
9172
|
+
let a2 = 0;
|
|
9173
|
+
for (let i3 = 0; i3 < 2; i3++) for (let l = 0; l < 2; l++) {
|
|
9174
|
+
let c3 = o3 + i3, m2 = e + l;
|
|
9175
|
+
c3 < n2 && m2 < r && (a2 += t[c3 * r + m2]);
|
|
9176
|
+
}
|
|
9177
|
+
s2[o3 * r + e] = a2 / 4;
|
|
9175
9178
|
}
|
|
9176
|
-
return
|
|
9179
|
+
return s2;
|
|
9177
9180
|
}
|
|
9178
|
-
function
|
|
9179
|
-
|
|
9180
|
-
for (let
|
|
9181
|
-
let
|
|
9182
|
-
|
|
9181
|
+
function U(t, r, n2, s2, o3, e) {
|
|
9182
|
+
t.fill(0);
|
|
9183
|
+
for (let a2 = 1; a2 < e - 1; a2++) for (let i3 = 1; i3 < o3 - 1; i3++) {
|
|
9184
|
+
let l = a2 * o3 + i3, c3 = r[l], m2 = n2[l], u = 2 * c3 * m2 + s2, d2 = c3 * c3 + m2 * m2 + s2, h4 = u / d2, g2 = Math.floor(h4 * 255), f = l * 4;
|
|
9185
|
+
t[f] = g2, t[f + 1] = g2, t[f + 2] = g2, t[f + 3] = 255;
|
|
9183
9186
|
}
|
|
9184
9187
|
}
|
|
9185
|
-
function
|
|
9186
|
-
let
|
|
9187
|
-
for (let
|
|
9188
|
-
let
|
|
9189
|
-
|
|
9188
|
+
function M(t, r, n2, s2) {
|
|
9189
|
+
let o3 = n2 * s2;
|
|
9190
|
+
for (let e = 0; e < o3; e++) {
|
|
9191
|
+
let a2 = e * 4, i3 = t[a2], l = t[a2 + 1], c3 = t[a2 + 2];
|
|
9192
|
+
r[e] = 0.298936 * i3 + 0.587043 * l + 0.114021 * c3;
|
|
9190
9193
|
}
|
|
9191
9194
|
}
|
|
9192
|
-
function
|
|
9193
|
-
let
|
|
9194
|
-
for (let
|
|
9195
|
-
let
|
|
9196
|
-
|
|
9195
|
+
function S(t, r, n2) {
|
|
9196
|
+
let s2 = new Float32Array(r * n2);
|
|
9197
|
+
for (let o3 = 1; o3 < n2 - 1; o3++) for (let e = 1; e < r - 1; e++) {
|
|
9198
|
+
let a2 = o3 * r + e, i3 = t[(o3 - 1) * r + (e - 1)], l = t[(o3 - 1) * r + e], c3 = t[(o3 - 1) * r + (e + 1)], m2 = t[o3 * r + (e - 1)], u = t[o3 * r + (e + 1)], d2 = t[(o3 + 1) * r + (e - 1)], h4 = t[(o3 + 1) * r + e], g2 = t[(o3 + 1) * r + (e + 1)], f = (i3 + m2 + d2 - c3 - u - g2) / 3, b = (i3 + l + c3 - d2 - h4 - g2) / 3;
|
|
9199
|
+
s2[a2] = Math.sqrt(f * f + b * b);
|
|
9197
9200
|
}
|
|
9198
|
-
return
|
|
9201
|
+
return s2;
|
|
9199
9202
|
}
|
|
9200
|
-
function
|
|
9201
|
-
let
|
|
9202
|
-
for (let
|
|
9203
|
-
let
|
|
9204
|
-
|
|
9203
|
+
function z(t, r, n2, s2, o3) {
|
|
9204
|
+
let e = [];
|
|
9205
|
+
for (let a2 = 1; a2 < o3 - 1; a2++) for (let i3 = 1; i3 < s2 - 1; i3++) {
|
|
9206
|
+
let l = a2 * s2 + i3, c3 = t[l], m2 = r[l], u = 2 * c3 * m2 + n2, d2 = c3 * c3 + m2 * m2 + n2;
|
|
9207
|
+
e.push(u / d2);
|
|
9205
9208
|
}
|
|
9206
|
-
return new Float32Array(
|
|
9209
|
+
return new Float32Array(e);
|
|
9207
9210
|
}
|
|
9208
|
-
function
|
|
9209
|
-
let
|
|
9210
|
-
if (
|
|
9211
|
-
let
|
|
9212
|
-
for (let
|
|
9213
|
-
let
|
|
9214
|
-
for (let
|
|
9215
|
-
let
|
|
9216
|
-
|
|
9211
|
+
function T(t) {
|
|
9212
|
+
let r = t.length;
|
|
9213
|
+
if (r === 0) return 0;
|
|
9214
|
+
let n2 = 0;
|
|
9215
|
+
for (let e = 0; e < r; e++) n2 += t[e];
|
|
9216
|
+
let s2 = n2 / r, o3 = 0;
|
|
9217
|
+
for (let e = 0; e < r; e++) {
|
|
9218
|
+
let a2 = t[e] - s2;
|
|
9219
|
+
o3 += a2 * a2;
|
|
9217
9220
|
}
|
|
9218
|
-
return
|
|
9221
|
+
return o3 /= r, Math.sqrt(o3);
|
|
9219
9222
|
}
|
|
9220
|
-
var
|
|
9223
|
+
var q = G;
|
|
9221
9224
|
|
|
9222
9225
|
// src/commands/gmsd.ts
|
|
9223
9226
|
function printUsage() {
|
|
@@ -9321,29 +9324,29 @@ async function main() {
|
|
|
9321
9324
|
codec.read(image1),
|
|
9322
9325
|
codec.read(image2)
|
|
9323
9326
|
]);
|
|
9324
|
-
if (img1.width !== img2.width || img1.height !== img2.height) {
|
|
9325
|
-
throw new Error(
|
|
9326
|
-
`Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
|
|
9327
|
-
);
|
|
9328
|
-
}
|
|
9329
9327
|
let outputData;
|
|
9330
9328
|
if (options.outputPath) {
|
|
9331
9329
|
outputData = new Uint8Array(img1.data.length);
|
|
9332
9330
|
}
|
|
9331
|
+
const output = outputData && {
|
|
9332
|
+
data: outputData,
|
|
9333
|
+
width: img1.width,
|
|
9334
|
+
height: img1.height
|
|
9335
|
+
};
|
|
9333
9336
|
const gmsdOptions = {
|
|
9334
9337
|
downsample: options.downsample || 0,
|
|
9335
|
-
c: options.gmsdC
|
|
9338
|
+
c: options.gmsdC,
|
|
9339
|
+
output
|
|
9336
9340
|
};
|
|
9337
9341
|
const startTime = performance.now();
|
|
9338
|
-
const
|
|
9339
|
-
img1.data,
|
|
9340
|
-
img2.data,
|
|
9341
|
-
outputData,
|
|
9342
|
-
img1.width,
|
|
9343
|
-
img1.height,
|
|
9344
|
-
gmsdOptions
|
|
9345
|
-
);
|
|
9342
|
+
const comparison = q(img1, img2, gmsdOptions);
|
|
9346
9343
|
const duration = performance.now() - startTime;
|
|
9344
|
+
if (comparison.kind === "dimension-mismatch") {
|
|
9345
|
+
throw new Error(
|
|
9346
|
+
`Image dimensions do not match: ${img1.width}x${img1.height} vs ${img2.width}x${img2.height}`
|
|
9347
|
+
);
|
|
9348
|
+
}
|
|
9349
|
+
const score = comparison.score;
|
|
9347
9350
|
if (options.outputPath && outputData) {
|
|
9348
9351
|
await codec.write(
|
|
9349
9352
|
{
|