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
This library is API-compatible with [node-libpng](https://www.npmjs.com/package/node-libpng). It's simple to use decoded images as well as encoding them:
This represents the total amount of pixels differing between both images.
114
+
115
+
#### totalDelta
116
+
117
+
This is the summed up total perceived difference of all pixels. It grows with the color difference of every unmatched pixel.
118
+
119
+
In comparison to the [pixels](https://prior99.github.io/native-image-diff/docs/interfaces/diffresult.html#pixels) property this property also represents how different all colors were. Comparing a white image
120
+
with a black image would yield a higher difference as comparing an orange with a red image.
121
+
122
+
It doesn't feature any specific unit and should be used for relative comparisons only.
123
+
124
+
#### image
125
+
126
+
This property is only generate if [generateDiffImage](https://prior99.github.io/native-image-diff/docs/interfaces/diffimagesarguments.html#generatediffimage) is set to `true` (default).
127
+
128
+
It's properties `width` and `height` represent the dimensions of the generated image in pixels and `data` holds a RGBA buffer
129
+
of raw image data showing the visual difference between both input images. Different pixels are drawn in red and pixels which
130
+
only differed between both images because of antialiasing will be drawn in yellow. This is only true if [detectAntialiasing](https://prior99.github.io/native-image-diff/docs/interfaces/diffimagesarguments.html#detectantialiasing)
131
+
is set to `true` (default).
132
+
133
+
### Antialiasing Detection
134
+
135
+
By default this library will try to detect whether a pixel was part of antialiasing and ignore the respective change.
136
+
This works ~90% of the time:
137
+
138
+
These images (one with and one without antialiasing):
The yellow pixels represent detected antialiasing will not be included in the [pixels](https://prior99.github.io/native-image-diff/docs/interfaces/diffresult.html#pixels)
Disable the detection by providing `false` as [detectAntialiasing](https://prior99.github.io/native-image-diff/docs/interfaces/diffimagesarguments.html#detectantialiasing).
154
+
155
+
### Color threshold
156
+
157
+
It's possible to specify a different [colorThreshold](https://prior99.github.io/native-image-diff/docs/interfaces/diffimagesarguments.html#colorthreshold).
158
+
159
+
The color threshold ranges from `0` to `1` with `1` permitting all changes and `0` permitting none.
160
+
It influences the allowed per-pixel color difference.
161
+
162
+
The following example shows the visual difference between a gradient and a red rectangle with different thresholds:
0 commit comments