@vizzly-testing/honeydiff 0.5.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/CHANGELOG.md CHANGED
@@ -5,6 +5,23 @@ 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
+
8
25
  ## [0.5.0] - 2025-12-04
9
26
 
10
27
  ## 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;
@@ -139,6 +145,22 @@ export interface CompareOptions {
139
145
  */
140
146
  includeSSIM?: boolean;
141
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
+
142
164
  /**
143
165
  * Path to save the diff image (highlighted differences)
144
166
  * @default undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizzly-testing/honeydiff",
3
- "version": "0.5.0",
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",
@@ -69,6 +69,12 @@
69
69
  "load-platform.cjs",
70
70
  "platforms/*.node",
71
71
  "README.md",
72
+ "CHANGELOG.md",
73
+ "index.js",
74
+ "index.d.ts",
75
+ "load-platform.cjs",
76
+ "platforms/*.node",
77
+ "README.md",
72
78
  "CHANGELOG.md"
73
79
  ],
74
80
  "engines": {