Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including compare-image-data with all npm packages installed. Try it out:

var compareImageData = require("compare-image-data")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

compare-image-data v1.0.1

Compare Image

A small library to compare ImageData objects.


npm install compare-image-data


The library exposes 2 functions at the moment.

isSame(a: ImageData, b: ImageData): boolean
isSubset(imageData: ImageData, subset: ImageData): boolean


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);

compareImage.isSubset(imageDataA, imageDataC); // true

Look at the tests for more examples.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free