@blazediff/bin 0.7.1 → 1.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.
Files changed (3) hide show
  1. package/README.md +65 -0
  2. package/dist/cli.js +4 -4
  3. package/package.json +5 -5
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @blazediff/bin
2
+
3
+ <div align="center">
4
+
5
+ [![npm bundle size](https://img.shields.io/bundlephobia/min/%40blazediff%2Fbin)](https://www.npmjs.com/package/@blazediff/bin)
6
+ [![NPM Downloads](https://img.shields.io/npm/dy/%40blazediff%2Fbin)](https://www.npmjs.com/package/@blazediff/bin)
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/bin
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ blazediff <image1> <image2> [options]
22
+ ```
23
+
24
+ **Arguments:**
25
+ - `image1` - Path to the first image
26
+ - `image2` - Path to the second image
27
+
28
+ **Options:**
29
+ - `-o, --output <path>` - Output path for the diff image
30
+ - `-t, --threshold <num>` - Matching threshold (0 to 1, default: 0.1)
31
+ - `-a, --alpha <num>` - Opacity of original image in diff (default: 0.1)
32
+ - `--aa-color <r,g,b>` - Color for anti-aliased pixels (default: 255,255,0)
33
+ - `--diff-color <r,g,b>` - Color for different pixels (default: 255,0,0)
34
+ - `--diff-color-alt <r,g,b>` - Alternative color for dark differences
35
+ - `--include-aa` - Include anti-aliasing detection
36
+ - `--diff-mask` - Draw diff over transparent background
37
+ - `--transformer <name>` - Specify transformer to use (pngjs, sharp)
38
+ - `--color-space <name>` - Specify color space to use (yiq, ycbcr)
39
+ - `-h, --help` - Show help message
40
+
41
+ ## Examples
42
+
43
+ ```bash
44
+ # Basic comparison
45
+ blazediff image1.png image2.png
46
+
47
+ # Save diff image with custom threshold
48
+ blazediff image1.png image2.png -o diff.png -t 0.05
49
+
50
+ # Use Sharp transformer for better performance
51
+ blazediff image1.png image2.png --transformer sharp -o diff.png
52
+
53
+ # JPEG support (requires Sharp transformer)
54
+ blazediff image1.jpg image2.jpg --transformer sharp -o diff.png
55
+ ```
56
+
57
+ ## Transformers
58
+
59
+ - **pngjs** - Pure JavaScript, works everywhere. Supports PNG only.
60
+ - **sharp** - Native bindings, significantly faster. Supports PNG and JPEG.
61
+
62
+ ## Exit Codes
63
+
64
+ - `0` - Images are identical
65
+ - `1` - Images have differences or error occurred
package/dist/cli.js CHANGED
@@ -97,8 +97,8 @@ Examples:
97
97
  `);
98
98
  }
99
99
  function parseRGB(colorStr) {
100
- const parts = colorStr.split(",").map((s) => parseInt(s.trim()));
101
- if (parts.length !== 3 || parts.some((p) => isNaN(p) || p < 0 || p > 255)) {
100
+ const parts = colorStr.split(",").map((s) => parseInt(s.trim(), 10));
101
+ if (parts.length !== 3 || parts.some((p) => Number.isNaN(p) || p < 0 || p > 255)) {
102
102
  throw new Error(
103
103
  `Invalid RGB color format: ${colorStr}. Expected format: r,g,b (e.g., 255,0,0)`
104
104
  );
@@ -134,7 +134,7 @@ function parseArgs() {
134
134
  case "--threshold":
135
135
  if (nextArg) {
136
136
  const threshold = parseFloat(nextArg);
137
- if (isNaN(threshold) || threshold < 0 || threshold > 1) {
137
+ if (Number.isNaN(threshold) || threshold < 0 || threshold > 1) {
138
138
  throw new Error(
139
139
  `Invalid threshold: ${nextArg}. Must be between 0 and 1`
140
140
  );
@@ -147,7 +147,7 @@ function parseArgs() {
147
147
  case "--alpha":
148
148
  if (nextArg) {
149
149
  const alpha = parseFloat(nextArg);
150
- if (isNaN(alpha) || alpha < 0 || alpha > 1) {
150
+ if (Number.isNaN(alpha) || alpha < 0 || alpha > 1) {
151
151
  throw new Error(
152
152
  `Invalid alpha: ${nextArg}. Must be between 0 and 1`
153
153
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazediff/bin",
3
- "version": "0.7.1",
3
+ "version": "1.0.0",
4
4
  "description": "Command-line interface for the blazediff image comparison library",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -37,10 +37,10 @@
37
37
  "homepage": "https://github.com/teimurjan/blazediff",
38
38
  "license": "MIT",
39
39
  "dependencies": {
40
- "@blazediff/core": "0.7.1",
41
- "@blazediff/pngjs-transformer": "0.7.1",
42
- "@blazediff/sharp-transformer": "0.7.1",
43
- "@blazediff/types": "0.7.1"
40
+ "@blazediff/core": "1.0.0",
41
+ "@blazediff/pngjs-transformer": "1.0.0",
42
+ "@blazediff/sharp-transformer": "1.0.0",
43
+ "@blazediff/types": "1.0.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^24.3.0",