@blazediff/cli 1.8.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/LICENSE.md +21 -0
- package/README.md +124 -0
- package/dist/cli.js +979 -0
- 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 +69 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +0 -0
- package/package.json +56 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Teimur Gasanov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @blazediff/cli
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@blazediff/cli)
|
|
6
|
+
[](https://www.npmjs.com/package/@blazediff/cli)
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
Command-line interface for the BlazeDiff image comparison library.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @blazediff/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
blazediff <command> <image1> <image2> [options]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
BlazeDiff supports multiple comparison algorithms, each optimized for different use cases:
|
|
27
|
+
|
|
28
|
+
### `diff` - Pixel-by-pixel comparison (default)
|
|
29
|
+
Fast pixel-level comparison for detecting visual regressions.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
blazediff diff image1.png image2.png [options]
|
|
33
|
+
# Or simply:
|
|
34
|
+
blazediff image1.png image2.png [options]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Options:**
|
|
38
|
+
- `-o, --output <path>` - Output path for the diff image
|
|
39
|
+
- `-t, --threshold <num>` - Matching threshold (0 to 1, default: 0.1)
|
|
40
|
+
- `-a, --alpha <num>` - Opacity of original image in diff (default: 0.1)
|
|
41
|
+
- `--aa-color <r,g,b>` - Color for anti-aliased pixels (default: 255,255,0)
|
|
42
|
+
- `--diff-color <r,g,b>` - Color for different pixels (default: 255,0,0)
|
|
43
|
+
- `--diff-color-alt <r,g,b>` - Alternative color for dark differences
|
|
44
|
+
- `--include-aa` - Include anti-aliasing detection
|
|
45
|
+
- `--diff-mask` - Draw diff over transparent background
|
|
46
|
+
- `--color-space <name>` - Specify color space to use (yiq, ycbcr)
|
|
47
|
+
- `--transformer <name>` - Specify transformer to use (pngjs, sharp)
|
|
48
|
+
- `-h, --help` - Show help message
|
|
49
|
+
|
|
50
|
+
### `gmsd` - Gradient Magnitude Similarity Deviation
|
|
51
|
+
Perceptual quality metric based on gradient similarity.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
blazediff gmsd image1.png image2.png [options]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Options:**
|
|
58
|
+
- `-o, --output <path>` - Output path for GMS similarity map
|
|
59
|
+
- `--downsample <0|1>` - Downsample factor (0=full-res, 1=2x, default: 0)
|
|
60
|
+
- `--gmsd-c <num>` - Stability constant (default: 170)
|
|
61
|
+
- `--transformer <name>` - Specify transformer to use (pngjs, sharp)
|
|
62
|
+
- `-h, --help` - Show help message
|
|
63
|
+
|
|
64
|
+
### `ssim` - Structural Similarity Index
|
|
65
|
+
Industry-standard metric for measuring structural similarity.
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
blazediff ssim image1.png image2.png [options]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Options:**
|
|
72
|
+
- `-o, --output <path>` - Output path for SSIM map visualization
|
|
73
|
+
- `--transformer <name>` - Specify transformer to use (pngjs, sharp)
|
|
74
|
+
- `-h, --help` - Show help message
|
|
75
|
+
|
|
76
|
+
### `msssim` - Multi-Scale Structural Similarity Index
|
|
77
|
+
Enhanced SSIM that operates at multiple image scales.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
blazediff msssim image1.png image2.png [options]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Options:**
|
|
84
|
+
- `-o, --output <path>` - Output path for MS-SSIM map visualization
|
|
85
|
+
- `--transformer <name>` - Specify transformer to use (pngjs, sharp)
|
|
86
|
+
- `-h, --help` - Show help message
|
|
87
|
+
|
|
88
|
+
## Examples
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Pixel-by-pixel diff (default)
|
|
92
|
+
blazediff image1.png image2.png
|
|
93
|
+
blazediff diff image1.png image2.png -o diff.png -t 0.05
|
|
94
|
+
|
|
95
|
+
# GMSD similarity metric
|
|
96
|
+
blazediff gmsd image1.png image2.png
|
|
97
|
+
blazediff gmsd image1.png image2.png -o gms-map.png
|
|
98
|
+
|
|
99
|
+
# SSIM structural similarity
|
|
100
|
+
blazediff ssim image1.png image2.png
|
|
101
|
+
blazediff ssim image1.png image2.png -o ssim-map.png
|
|
102
|
+
|
|
103
|
+
# MS-SSIM multi-scale similarity
|
|
104
|
+
blazediff msssim image1.png image2.png
|
|
105
|
+
blazediff msssim image1.png image2.png -o msssim-map.png
|
|
106
|
+
|
|
107
|
+
# Use Sharp transformer for better performance
|
|
108
|
+
blazediff ssim image1.jpg image2.jpg --transformer sharp
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Transformers
|
|
112
|
+
|
|
113
|
+
- **pngjs** - Pure JavaScript, works everywhere. Supports PNG only.
|
|
114
|
+
- **sharp** - Native bindings, significantly faster. Supports PNG and JPEG.
|
|
115
|
+
|
|
116
|
+
## Exit Codes
|
|
117
|
+
|
|
118
|
+
### Diff Mode
|
|
119
|
+
- `0` - Images are identical
|
|
120
|
+
- `1` - Images have differences or error occurred
|
|
121
|
+
|
|
122
|
+
### GMSD, SSIM, MS-SSIM Modes
|
|
123
|
+
- `0` - Images are highly similar (score >= 0.95)
|
|
124
|
+
- `1` - Images have noticeable differences (score < 0.95) or error occurred
|