Sometimes it is required to compare two images to see how similar they are. It is a complicated process and required good knowledge to accomplish it. The open source pixelmatch library can be a useful choice for comparing two images in any environment. As the library has no dependencies and works on raw typed arrays of image data, so can be used in multiple environments like Node or browsers, etc.
The Anti-aliasing detection is a useful feature because usually it has been observed that rendering the same data on different applications, devices, or operating systems can generate slightly dissimilar results. But mostly it is recommended to ignore these small differences or tests to capture more meaningful data.
At A Glance
An overview of pixelmatch features.
- Compare images
- Check dimensions
- Anti-aliasing detection
pixelmatch supports popular Image file formats listed below.
pixelmatch can be used in multiple environments like Node or browsers etc.
Getting Started with pixelmatch
The recommended way to install pixelmatch is via NPM. Please use the following command to install it.
Install pixelmatch via NPM
npm install pixelmatch
What is Pixel Match Testing?
If you need to compare two images to check if there is any difference between then you can use pixel match testing for this purpose. There can be two types of images, the original image, and the modified image. You can use an application that can fetch images from the screenshot of your app and after that, the image comparison library can be used to compare these images and display the results.