Socket
Socket
Sign inDemoInstall

pixelmatch

Package Overview
Dependencies
Maintainers
121
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixelmatch

The smallest and fastest pixel-level image comparison library.


Version published
Maintainers
121
Created

What is pixelmatch?

The pixelmatch npm package is a high-performance, zero-dependency library for comparing two images. It is primarily used to find differences between images in terms of pixels, making it highly useful for tasks such as visual regression testing, automated testing of graphics or rendering engines, and anywhere else where image differences need to be quantified programmatically.

What are pixelmatch's main functionalities?

Image comparison

This feature allows you to compare two images and find the number of pixels that differ between them. The `img1` and `img2` parameters are the image data of the two images to compare, `diff` is a Uint8Array or Uint8ClampedArray to store the diff output, `width` and `height` specify the dimensions of the images, and the `threshold` option in the options object allows you to specify the sensitivity of the comparison.

const numDiffPixels = pixelmatch(img1, img2, diff, width, height, {threshold: 0.1});

Customizable comparison

Beyond basic image comparison, pixelmatch allows for customization of the comparison process. The `includeAA` option, for example, can be set to false to exclude anti-aliased pixels from being considered as differences. This is useful for comparing images where anti-aliasing may vary but is not considered a significant difference.

const numDiffPixels = pixelmatch(img1, img2, diff, width, height, {threshold: 0.1, includeAA: false});

Other packages similar to pixelmatch

Keywords

FAQs

Package last updated on 01 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc