Get the difference between two images
with minimal dependencies.
It depends only on
Warning: img-diff is experimental. You can help us improve it by testing it and contributing!
npm install img-diff
require 'img-diff'tolerance = 0.0 # percent allowed to be differentimage1 = '' # base64 png stringimage2 = '' # base64 png stringimagesMatch image1image2tolerance
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.
require 'img-diff'image = '' # base64 png stringsection =x: 10y: 10width: 100height: 100croppedImage = crop imagesection