How to use img-diff-js - 1 common examples

To help you get started, we’ve selected a few img-diff-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github reg-viz / reg-cli / src / diff.js View on Github external
]).then(([actualHash, expectedHash]) => {
    if (actualHash === expectedHash) {
      if (!process || !process.send) return;
      return process.send({ passed: true, image });
    }
    const diffImage = image.replace(/\.[^\.]+$/, ".png");
    return imgDiff({
      actualFilename: path.join(actualDir, image),
      expectedFilename: path.join(expectedDir, image),
      diffFilename: path.join(diffDir, diffImage),
      options: {
        threshold: matchingThreshold,
        includeAA: !enableAntialias,
      },
    })
      .then(({ width, height, diffCount }) => {
        const passed = isPassed({ width, height, diffCount, thresholdPixel, thresholdRate });
        if (!process || !process.send) return;
        process.send({ passed, image });
      })
  })
};

img-diff-js

Library to compare 2 images

MIT
Latest version published 8 months ago

Package Health Score

71 / 100
Full package analysis

Popular img-diff-js functions