Skip to content

imageSimilarity

ts
imageSimilarity(before: DiffPixels, after: DiffPixels, options?: DiffImageOptions): DiffImageSimilarity
dart
DiffImageSimilarity imageSimilarity(DiffPixels before, DiffPixels after, [DiffImageOptions? options]);
FieldWhat it says
similarityHow alike the two are, from 0 to 1. Times a hundred is the percentage.
identicalWhether not one pixel came out different.
pixelsHow many pixels at least one of the two covers.
matchedHow many of those came out the same.
changedHow many both cover and disagree about.
addedHow many only the second covers.
removedHow many only the first covers.
distanceHow far apart two pixels are on average, over the pixels both cover.
beforeHow large the first picture was.
afterHow large the second one was.

The whole comparison runs underneath, so every option means what it means there. A comparison already worked out needs no second pass: 1 - result.stats.ratio is the same number.

Released under the MIT License