Rembrandt.JS - Client- and server-side image comparison library
Rembrandt.JS is a image comparison library that works both with the
HTML5 Canvas2D API as well as the drop-in Node.JS replacement
node-canvas
.
We created Rembrandt.JS to have an easy-to-use image comparison library for our internal tests for PhotoEditorSDK. Go check it out. It's really awesome. :)
Installation
Node.JS
Please follow the installation instructions over at node-canvas in order to correctly install all required system libraries. Afterwards, just run:
npm install rembrandt
Browser
Download the latest build from our Releases page, then include it like this:
The Rembrandt
JavaScript variable is now globally available.
Using module bundlers like Webpack etc.
Install Rembrandt via npm install rembrandt
, then require it inside your JavaScript like so:
var Rembrandt =
Usage
Here is an example (ES6 / ES2015):
const rembrandt = // `imageA` and `imageB` can be either Strings (file path on node.js, // public url on Browsers) or Buffers imageA: '/path/to/imageA' imageB: fs // Needs to be one of Rembrandt.THRESHOLD_PERCENT or Rembrandt.THRESHOLD_PIXELS thresholdType: RembrandtTHRESHOLD_PERCENT // The maximum threshold (0...1 for THRESHOLD_PERCENT, pixel count for THRESHOLD_PIXELS maxThreshold: 001 // Maximum color delta (0...255): maxDelta: 20 // Maximum surrounding pixel offset maxOffset: 0 renderComposition: true // Should Rembrandt render a composition image? compositionMaskColor: RembrandtColorRED // Color of unmatched pixels // Run the comparisonrembrandt
License
See LICENSE.md
Authors and Contributors
Copyright (c) 2016 by PhotoEditorSDK.com