1.0.1 • Published 7 years ago
compare-image-data v1.0.1
Compare Image
A small library to compare ImageData objects.
Install
npm install compare-image-data
API
The library exposes 2 functions at the moment.
isSame(a: ImageData, b: ImageData): boolean
isSubset(imageData: ImageData, subset: ImageData): boolean
Example
import * as compareImage from 'compare-image-data'
const imageDataA = new ImageData(10, 10);
const imageDataB = new ImageData(10, 10);
compareImage.isSame(imageDataA, imageDataB); // true
const imageDataC = new ImageData(5, 5);
imageDataA.fill(255);
imageDataC.fill(255);
compareImage.isSubset(imageDataA, imageDataC); // true
Look at the tests for more examples.