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
{{ message }}
Repository navigation
Commit ab76f52
Browse filesBrowse the repository at this point in the historyBrowse files
-[A perceptual color space for image processing](https://bottosson.github.io/posts/oklab/) (2020, Björn Ottosson) — the OKLab color space used for color difference.
23
-
-[Distance metrics for very large color differences](https://onlinelibrary.wiley.com/doi/10.1002/col.22451) (2019, Saeideh Abasi et al.) — the OKLab HyAB metric used to compare colors.
24
-
-[Anti-aliased pixel and intensity slope detector](https://www.researchgate.net/publication/234126755_Anti-aliased_Pixel_and_Intensity_Slope_Detector) (2009, Vytautas Vyšniauskas)
18
+
Compares colors using the [OKLab color space](https://bottosson.github.io/posts/oklab/) (Björn Ottosson, 2020)
19
+
and the [HyAB distance](https://onlinelibrary.wiley.com/doi/10.1002/col.22451) (Saeideh Abasi et al., 2019),
20
+
and detects anti-aliasing with the [anti-aliased pixel and intensity slope detector](https://www.researchgate.net/publication/234126755_Anti-aliased_Pixel_and_Intensity_Slope_Detector)
-`img1`, `img2` — Image data of the images to compare (`Buffer`, `Uint8Array` or `Uint8ClampedArray`). **Note:** image dimensions must be equal.
41
-
-`output` — Image data to write the diff to, or `null` if don't need a diff image.
42
-
-`width`, `height` — Width and height of the images. Note that _all three images_ need to have the same dimensions.
37
+
Compares two images, writes the output diff and returns the number of mismatched pixels (or the
38
+
highest count in any window with `windowSize`).
39
+
40
+
-`img1`, `img2` — Image data of the images to compare (`Buffer`, `Uint8Array` or `Uint8ClampedArray`).
41
+
-`output` — Image data to write the diff to, or `null` if you don't need a diff image.
42
+
-`width`, `height` — Width and height of the images. **Note:**_all three images_ need to have the same dimensions.
43
43
44
44
`options` is an object literal with the following properties:
45
45
@@ -49,13 +49,11 @@ Implements ideas from the following papers:
49
49
-`aaColor` — The color of anti-aliased pixels in the diff output in `[R, G, B]` format. `[255, 255, 0]` by default.
50
50
-`diffColor` — The color of differing pixels in the diff output in `[R, G, B]` format. `[255, 0, 0]` by default.
51
51
-`diffColorAlt` — An alternative color to use for dark on light differences to differentiate between "added" and "removed" parts. If not provided, all differing pixels use the color specified by `diffColor`. `null` by default.
52
-
-`diffMask` — Draw the diff over a transparent background (a mask), rather than over the original image. Will not draw anti-aliased pixels (if detected).
52
+
-`diffMask` — Draw the diff over a transparent background (a mask), rather than over the original image. Will not draw anti-aliased pixels (if detected).`false` by default.
53
53
-`checkerboard` — Blend semi-transparent pixels against a checkerboard pattern when comparing (`true`) rather than plain white (`false`), avoiding false matches between colors that only look alike over one background. `true` by default.
54
54
-`windowSize` — If set to a finite number `N`, return the maximum number of differing pixels in any `N`×`N` sliding window instead of the total count (see below). `Infinity` by default.
55
55
-`ignoreMask` — A `Uint8Array`, `Uint8ClampedArray` or `Buffer` with one value per pixel (`width * height` long); pixels with a non-zero value are excluded from the comparison and drawn as unchanged in the diff output. Not set by default.
56
56
57
-
Compares two images, writes the output diff and returns the number of mismatched pixels.
58
-
59
57
### Windowed diff counts
60
58
61
59
Normally the return value is the total number of differing pixels. With `windowSize: N` you get the
@@ -81,9 +79,12 @@ window. The default `Infinity` makes the window the whole image, which is the to
81
79
Pixelmatch comes with a binary that works with PNG images:
0 commit comments