Socket
Socket
Sign inDemoInstall

img-diff

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

img-diff

Minimal dependency sync image manipulation


Version published
Weekly downloads
9
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

img-diff

Get the difference between two images with minimal dependencies. It depends only on libpng.

Warning: img-diff is experimental. You can help us improve it by testing it and contributing!

usage

Install: npm install img-diff

Diff

{imagesMatch} = require 'img-diff'
tolerance = 0.0 # percent allowed to be different
image1 = '' # base64 png string
image2 = '' # base64 png string
imagesMatch image1, image2, tolerance

If the images don't match and are outside the tolerance, an error is thrown that contains both images as well as a diff image. The diff image can be saved to disk in order to see the difference.

Crop

{crop} = require 'img-diff'
image = '' # base64 png string
section =
  x: 10
  y: 10
  width: 100
  height: 100
croppedImage = crop image, section

FAQs

Package last updated on 16 Dec 2013

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