npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

image-difference

v2.0.7

Published

Create image differential between two images

Downloads

26,230

Readme

image-difference

Create image differential between two images

npm package Build Status

PeerDependencies Dependencies DevDependencies

The problem solved

difference

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

  1. 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

import imageDifference from '../src/imageDifference'

imageDifference(
  {
    actualFilename: `${__dirname}/images/hello-world.png`,
    expectedFilename: `${__dirname}/images/hello.png`,
    diffFilename: `${__dirname}/images/hello-diff.png`,
  },
  console.log
)

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% (25 runs sampled)
image-diff same x 1.07 ops/sec ±0.80% (25 runs sampled)

image-difference imagemagick1 diff x 4.43 ops/sec ±0.40% (41 runs sampled)
image-difference imagemagick1 same x 4.45 ops/sec ±0.49% (41 runs sampled)

image-difference imagemagick2 diff x 2.96 ops/sec ±0.49% (34 runs sampled)
image-difference imagemagick2 same x 2.94 ops/sec ±0.87% (34 runs sampled)

image-difference graphicsmagick diff x 2.32 ops/sec ±0.60% (31 runs sampled)
image-difference graphicsmagick same x 2.30 ops/sec ±0.72% (31 runs sampled)

pixelmatch diff x 0.79 ops/sec ±0.94% (23 runs sampled)
pixelmatch same x 3.58 ops/sec ±2.07% (37 runs sampled)

resemble diff x 0.59 ops/sec ±4.76% (22 runs sampled)
resemble same x 0.94 ops/sec ±0.85% (24 runs sampled)

looksSame diff x 2.09 ops/sec ±3.08% (30 runs sampled)
looksSame same x 1.08 ops/sec ±3.76% (25 runs sampled)

Contributing

brew install imagemagick@6 graphicsmagick
yarn
yarn test:watch

License

MIT