image-difference
Create image differential between two images
The problem solved
This is a fork of image-diff that is no longer maintained. This was created as part of a visual regression project and now supported as part of Argos-CI.
Installation
image-difference
depends on ImageMagick Please install this before continuing.
npm install --save image-difference
API
imageDifference(options) => Promise
Create image differential between two images
Arguments
options
(Object)options.actualFilename
(String): Path to actual image file. must exist.options.expectedFilename
(String): Path to expected image file. must exist.options.diffFilename
(String): Optional path to output differential image.options.metric
(String): Optional metric used for the computation of the output.
Returns
Promise
: Return the difference object with a total
and percentage
key.
Example
CLI Usage
Usage: [options] <actual-filename> <expected-filename> [diff-filename] Create image differential between two images Options: -h, --help output usage information -V, --version output the version number
Benchmark
We use imagemagick1
as the default implmentation
image-diff diff x 1.11 ops/sec ±1.21% image-diff same x 1.07 ops/sec ±0.80% image-difference imagemagick1 diff x 4.43 ops/sec ±0.40% image-difference imagemagick1 same x 4.45 ops/sec ±0.49% image-difference imagemagick2 diff x 2.96 ops/sec ±0.49% image-difference imagemagick2 same x 2.94 ops/sec ±0.87% image-difference graphicsmagick diff x 2.32 ops/sec ±0.60% image-difference graphicsmagick same x 2.30 ops/sec ±0.72% pixelmatch diff x 0.79 ops/sec ±0.94% pixelmatch same x 3.58 ops/sec ±2.07% resemble diff x 0.59 ops/sec ±4.76% resemble same x 0.94 ops/sec ±0.85% looksSame diff x 2.09 ops/sec ±3.08% looksSame same x 1.08 ops/sec ±3.76%
Contributing
brew install imagemagick@6 graphicsmagickyarnyarn test:watch
License
MIT