@vizzly-testing/honeydiff 0.4.3 → 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/CHANGELOG.md CHANGED
@@ -5,6 +5,66 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.0] - 2025-12-10
9
+
10
+ ## What's Changed
11
+
12
+ ### Added
13
+ - **Noise filtering with `minClusterSize` option** - New option to filter out single-pixel rendering variance while catching real visual changes. Defaults to `2` (filters isolated pixels), can be set to `1` for exact matching or `3+` for more permissive detection. Clustering is automatically enabled when `minClusterSize > 1`.
14
+
15
+ ### Changed
16
+ - **`isDifferent` now respects noise filtering** - When `minClusterSize` is set, small clusters below the threshold are filtered out, meaning `isDifferent` may be `false` even when `diffPixels > 0` (those pixels were classified as noise)
17
+ - **`diffPixels` reports raw count** - The raw pixel count is now unaffected by `minClusterSize` filtering, showing all differing pixels including those filtered as noise
18
+ - **Documentation improvements** - Added comprehensive documentation for the `minClusterSize` option in TypeScript types and README, including a behavior table and usage examples
19
+
20
+ ### Fixed
21
+ - Height differences now always count regardless of clustering (structural changes are never filtered as noise)
22
+
23
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.5.0...v0.6.0
24
+
25
+ ## [0.5.0] - 2025-12-04
26
+
27
+ ## What's Changed
28
+
29
+ ### Changed
30
+
31
+ **⚠️ BREAKING CHANGE: Switched from YIQ to CIEDE2000 for perceptual color comparison**
32
+
33
+ The image comparison algorithm has been upgraded to use the industry-standard CIEDE2000 (Delta E) metric, providing superior perceptual accuracy compared to the previous YIQ approach.
34
+
35
+ **API Changes:**
36
+ - **Removed:** `colorThreshold` option (0.0-1.0 scale)
37
+ - **Removed:** `pixelTolerance` option (0-255 scale)
38
+ - **Removed:** `ignoreColors` option
39
+ - **Added:** `threshold` option using CIEDE2000 Delta E units with intuitive perceptual scale:
40
+ - `0.0` = Exact pixel matching (strictest)
41
+ - `1.0` = Just Noticeable Difference (JND) - barely perceptible to trained observers
42
+ - `2.0` = **Recommended default** - ignores sub-pixel rendering variance, catches real differences
43
+ - `3.0+` = Permissive - high tolerance for rendering variations
44
+
45
+ **Migration Guide:**
46
+ ```typescript
47
+ // Before (v0.4.x)
48
+ const result = await compare('baseline.png', 'current.png', {
49
+ pixelTolerance: 10, // ❌ Removed
50
+ colorThreshold: 0.1, // ❌ Removed
51
+ ignoreColors: false // ❌ Removed
52
+ });
53
+
54
+ // After (v0.5.0)
55
+ const result = await compare('baseline.png', 'current.png', {
56
+ threshold: 2.0 // ✅ CIEDE2000 Delta E units (new default)
57
+ });
58
+ ```
59
+
60
+ **Benefits:**
61
+ - More accurate perceptual color difference detection
62
+ - Aligns with CIE standards used in color science
63
+ - Better handling of subtle color variations
64
+ - Improved anti-aliasing detection accuracy
65
+
66
+ **Full Changelog**: https://github.com/vizzly-testing/honeydiff/compare/v0.4.3...v0.5.0
67
+
8
68
  ## [0.4.3] - 2025-12-01
9
69
 
10
70
  ## What's Changed
package/README.md CHANGED
@@ -154,13 +154,14 @@ const result = await compare('baseline.png', 'current.png', {
154
154
  console.log('Artifacts saved to ./artifacts/');
155
155
  ```
156
156
 
157
- ### 5. Spatial Clustering
157
+ ### 5. Spatial Clustering & Noise Filtering
158
158
 
159
- Group nearby differences into regions to identify distinct changed areas.
159
+ Group nearby differences into regions and filter out single-pixel noise from rendering variance.
160
160
 
161
161
  ```javascript
162
162
  const result = await compare('img1.png', 'img2.png', {
163
- includeClusters: true
163
+ includeClusters: true,
164
+ minClusterSize: 2 // Default: filter single isolated pixels as noise
164
165
  });
165
166
 
166
167
  if (result.diffClusters) {
@@ -180,6 +181,13 @@ if (result.diffClusters) {
180
181
  // - Average intensity: 127.3
181
182
  ```
182
183
 
184
+ **Noise filtering values:**
185
+ | Value | Behavior |
186
+ |-------|----------|
187
+ | 1 | Exact matching - any different pixel counts |
188
+ | 2 | Default - filters single isolated pixels as rendering noise |
189
+ | 3+ | More permissive - only larger clusters detected |
190
+
183
191
  ### 6. Perceptual Similarity (SSIM)
184
192
 
185
193
  Beyond pixel counting - measure structural similarity from a human perception perspective.
@@ -445,6 +453,7 @@ interface CompareOptions {
445
453
  includeDiffPixels?: boolean; // List all diff pixels (memory intensive, default: false)
446
454
  includeClusters?: boolean; // Spatial clustering (default: false)
447
455
  includeSSIM?: boolean; // SSIM perceptual score (slow, default: false)
456
+ minClusterSize?: number; // Filter clusters smaller than this (default: 2)
448
457
 
449
458
  // Accessibility options
450
459
  includeAccessibilityData?: boolean; // RGB, luminance, WCAG (default: false)
@@ -464,10 +473,10 @@ interface CompareOptions {
464
473
  ```typescript
465
474
  interface DiffResult {
466
475
  // Basic metrics
467
- isDifferent: boolean; // Are images different?
476
+ isDifferent: boolean; // Are images different? (respects minClusterSize filtering)
468
477
  diffPercentage: number; // 0.0-100.0
469
478
  totalPixels: number;
470
- diffPixels: number;
479
+ diffPixels: number; // Raw count (unaffected by minClusterSize filtering)
471
480
 
472
481
  // Anti-aliasing
473
482
  aaPixelsIgnored: number;
package/index.d.ts CHANGED
@@ -61,13 +61,19 @@ export interface DiffCluster {
61
61
  }
62
62
 
63
63
  export interface DiffResult {
64
- /** Whether the images are different based on the comparison threshold */
64
+ /**
65
+ * Whether the images are different based on the comparison threshold
66
+ * Note: This respects minClusterSize filtering - small clusters may be filtered as noise
67
+ */
65
68
  isDifferent: boolean;
66
69
  /** Percentage of pixels that differ (0.0 - 100.0) */
67
70
  diffPercentage: number;
68
71
  /** Total number of pixels compared */
69
72
  totalPixels: number;
70
- /** Number of pixels that differ */
73
+ /**
74
+ * Number of pixels that differ (raw count, unaffected by minClusterSize filtering)
75
+ * Note: This may be > 0 even when isDifferent is false if small clusters were filtered as noise
76
+ */
71
77
  diffPixels: number;
72
78
  /** Number of pixels ignored due to anti-aliasing detection */
73
79
  aaPixelsIgnored: number;
@@ -93,19 +99,17 @@ export interface DiffResult {
93
99
 
94
100
  export interface CompareOptions {
95
101
  /**
96
- * Pixel difference threshold (0-255). Differences below this are ignored.
97
- * NOTE: When using YIQ comparison, use colorThreshold instead (0.0-1.0)
98
- * @default 0
99
- */
100
- pixelTolerance?: number;
101
-
102
- /**
103
- * Color difference threshold for YIQ comparison (0.0-1.0)
104
- * Set to 0.0 to use RGB comparison (default)
105
- * Set to 0.1 for odiff-style YIQ comparison
106
- * @default 0.0
102
+ * Perceptual color difference threshold using CIEDE2000 (Delta E units)
103
+ *
104
+ * The CIEDE2000 standard provides intuitive, perceptually uniform thresholds:
105
+ * - 0.0 = Exact pixel matching (strictest)
106
+ * - 1.0 = Just Noticeable Difference (JND) - barely perceptible to trained observers
107
+ * - 2.0 = Recommended default - ignores sub-pixel rendering variance, catches real differences
108
+ * - 3.0+ = Permissive - high tolerance for rendering variations
109
+ *
110
+ * @default 2.0
107
111
  */
108
- colorThreshold?: number;
112
+ threshold?: number;
109
113
 
110
114
  /**
111
115
  * Enable anti-aliasing detection to ignore AA differences
@@ -113,12 +117,6 @@ export interface CompareOptions {
113
117
  */
114
118
  antialiasing?: boolean;
115
119
 
116
- /**
117
- * Ignore color differences (compare only structure/brightness)
118
- * @default false
119
- */
120
- ignoreColors?: boolean;
121
-
122
120
  /**
123
121
  * Maximum number of differences to detect before stopping
124
122
  * @default undefined (unlimited)
@@ -147,6 +145,22 @@ export interface CompareOptions {
147
145
  */
148
146
  includeSSIM?: boolean;
149
147
 
148
+ /**
149
+ * Minimum cluster size to count as a real difference
150
+ *
151
+ * Clusters smaller than this threshold are filtered out as noise.
152
+ * This helps ignore run-to-run rendering variance (scattered single pixels)
153
+ * while still catching real visual changes (grouped pixel differences).
154
+ *
155
+ * - 1 = Exact matching - any different pixel counts
156
+ * - 2 = Default - filters single isolated pixels as noise
157
+ * - 3+ = More permissive - only larger clusters detected
158
+ *
159
+ * When set to a value > 1, clustering is automatically enabled.
160
+ * @default 2
161
+ */
162
+ minClusterSize?: number;
163
+
150
164
  /**
151
165
  * Path to save the diff image (highlighted differences)
152
166
  * @default undefined
@@ -194,7 +208,7 @@ export type ImageInput = string | Buffer;
194
208
  * @example
195
209
  * ```typescript
196
210
  * const result = await compare('baseline.png', 'current.png', {
197
- * pixelTolerance: 10,
211
+ * threshold: 2.0, // CIEDE2000 Delta E (default)
198
212
  * includeSSIM: true
199
213
  * });
200
214
  *
@@ -238,7 +252,7 @@ export function quickCompare(img1: ImageInput, img2: ImageInput): Promise<boolea
238
252
  * @example
239
253
  * ```typescript
240
254
  * const result = compareSync('baseline.png', 'current.png', {
241
- * pixelTolerance: 5,
255
+ * threshold: 3.0, // More lenient threshold
242
256
  * includeClusters: true
243
257
  * });
244
258
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly-testing/honeydiff",
3
- "version": "0.4.3",
3
+ "version": "0.6.0",
4
4
  "description": "High-performance image diffing for Node.js - Native bindings to Honeydiff Rust library",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -63,6 +63,18 @@
63
63
  "load-platform.cjs",
64
64
  "platforms/*.node",
65
65
  "README.md",
66
+ "CHANGELOG.md",
67
+ "index.js",
68
+ "index.d.ts",
69
+ "load-platform.cjs",
70
+ "platforms/*.node",
71
+ "README.md",
72
+ "CHANGELOG.md",
73
+ "index.js",
74
+ "index.d.ts",
75
+ "load-platform.cjs",
76
+ "platforms/*.node",
77
+ "README.md",
66
78
  "CHANGELOG.md"
67
79
  ],
68
80
  "engines": {