You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.js
+73-23Lines changed: 73 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,30 @@
1
-
1
+
/**
2
+
* Compare two equally sized images, pixel by pixel.
3
+
*
4
+
* @param {Uint8Array | Uint8ClampedArray} img1 First image data.
5
+
* @param {Uint8Array | Uint8ClampedArray} img2 Second image data.
6
+
* @param {Uint8Array | Uint8ClampedArray | void} output Image data to write the diff to, if provided.
7
+
* @param {number} width Input images width.
8
+
* @param {number} height Input images height.
9
+
*
10
+
* @param {Object} [options]
11
+
* @param {number} [options.threshold=0.1] Matching threshold (0 to 1); smaller is more sensitive.
12
+
* @param {boolean} [options.includeAA=false] Whether to skip anti-aliasing detection.
13
+
* @param {number} [options.alpha=0.1] Opacity of original image in diff output.
14
+
* @param {[number, number, number]} [options.aaColor=[255, 255, 0]] Color of anti-aliased pixels in diff output.
15
+
* @param {[number, number, number]} [options.diffColor=[255, 0, 0]] Color of different pixels in diff output.
16
+
* @param {[number, number, number]} [options.diffColorAlt=options.diffColor] Whether to detect dark on light differences between img1 and img2 and set an alternative color to differentiate between the two.
17
+
* @param {boolean} [options.diffMask=false] Draw the diff over a transparent background (a mask).
18
+
*
19
+
* @return {number} The number of mismatched pixels.
0 commit comments