compare-img
v1.0.3
Published
Compare two or more images at the binary level.
Downloads
22
Maintainers
Readme
compare-img
Compare two or more images at the binary level.
Docs
- Changelog
Demo
You can see a working demo here.
Browser usage
See how to use compare-img in the browser.
Usage
Installation.
npm install --save compare-img
Compare two same images.
Output: The comparison result of 'img/sample-1.png', 'img/sample-1.png' is true
import compare from 'compare-img';
let res = await compare('img/sample-1.png', 'img/sample-1.png');
console.log(`The comparison result of 'img/sample-1.png', 'img/sample-1.png' is ${res}`);
Compare two different images.
Output: The comparison result of 'img/sample-1.png', 'img/sample-2.png' is false
import compare from 'compare-img';
let res = await compare('img/sample-1.png', 'img/sample-2.png');
console.log(`The comparison result of 'img/sample-1.png', 'img/sample-2.png' is ${res}`);
Compare two or more images.
Output: The comparison result of 'img/sample-1.png', 'img/sample-1.png', 'img/sample-2.png' is false
import compare from 'compare-img';
let res = await compare('img/sample-1.png', 'img/sample-1.png', 'img/sample-2.png');
console.log(`The comparison result of 'img/sample-1.png', 'img/sample-1.png', 'img/sample-2.png' is ${res}`);
The images to be checked can also be passed as an array.
Output: The comparison result of 'img/sample-1.png', 'img/sample-1.png', 'img/sample-2.png' is false
import compare from 'compare-img';
let res = await compare(['img/sample-1.png', 'img/sample-1.png', 'img/sample-2.png']);
console.log(`The comparison result of 'img/sample-1.png', 'img/sample-1.png', 'img/sample-2.png' is ${res}`);
Author
Takuya Motoshima