diff --git a/README.md b/README.md index 343457e..c89e217 100644 --- a/README.md +++ b/README.md @@ -23,17 +23,18 @@ API NodeJS ------ -js-imagediff is available through the npm. It uses [node-canvas](https://github.com/LearnBoost/node-canvas) which requires lib cairo to be installed. -Install js-imagediff with `npm install -g imagediff`. +js-imagediff is available through npm and needs Node.js 18.12 or later on the 18 line, or 20.9 or later (`^18.12.0 || >=20.9.0`, as node-canvas 3 does). In Node.js it draws with [node-canvas](https://github.com/Automattic/node-canvas) 3, an optional dependency that installs from prebuilt binaries on common platforms; elsewhere it builds from source, which needs Cairo and the other libraries listed in the node-canvas [installation guide](https://github.com/Automattic/node-canvas#installation). + +Install the library with `npm install imagediff` and load it with `require('imagediff')`, or install the command line tool with `npm install -g imagediff`. ### Command Line -* `imagediff [-e|equal] [-t|tolerance VALUE] FILE_A FILE_B` tests equality of two image files with an optional tolerance, printing 'true' or 'false'. -* `imagediff [-d|diff] FILE_A FILE_B OUTPUT_FILE` renders an imagediff between two files, saving as the output file. +* `imagediff [-e|--equal] [-t|--tolerance VALUE] FILE_A FILE_B` tests equality of two image files with an optional tolerance, printing `true` or `false` and exiting with status 0 or 1. +* `imagediff [-d|--diff] FILE_A FILE_B OUTPUT_FILE` renders an imagediff between two files, saving it as a PNG in the output file. ### Cannot find module 'canvas' -Canvas has been moved to an optional dependency for better browser and browserify support. If you see a message that the module cannot be found, please check `npm install` first, incase there was indeed an issue installing it. This relates to https://github.com/HumbleSoftware/js-imagediff/issues/22. Please let me know if you have any issues on account of this, or know of a better work around. +Canvas is an optional dependency for better browser and bundler support, so the library loads without it and reports this error when it first needs a canvas. If you see it in Node.js, check the output of `npm install`, in case node-canvas failed to install. This relates to https://github.com/HumbleSoftware/js-imagediff/issues/22. Unit Testing Canvas ------------------- @@ -51,25 +52,28 @@ To use matchers: beforeEach(function () { jasmine.addMatchers(imagediff.jasmine); }); + + it('draws the expected image', function () { + expect(canvas).toImageDiffEqual(expectedImage, 2); + }); ``` Demo ---- -* A demo is available at http://humblesoftware.github.com/js-imagediff/ -* A Jasmine test demo is available at http://humblesoftware.github.com/js-imagediff/test.html +A demo is available at https://humblesoftware.github.io/js-imagediff/, and the same example is in [`examples/`](examples/) in this repository. Users ----- -* [Flotr2](http://humblesoftware.com/flotr2/) - unit testing +* [Flotr2](https://humblesoftware.com/flotr2/) - unit testing * [Envision.js](https://github.com/HumbleSoftware/envisionjs) - unit testing * [CSS Critic](https://github.com/cburgmer/csscritic) - A CSS regression testing framework -* [HUSL - Human-friendly HSL](http://boronine.com/husl/) - used for regression testing before release. +* [HSLuv (formerly HUSL)](https://www.hsluv.org/) - used for regression testing before release. * [SUCCSS](https://github.com/B2F/Succss) - CSS regression testing. -* [Origami.js](https://github.com/raphamorim/origami.js) - A canvas library +* [Origami.js](https://github.com/raphamorim/origami.js) - A canvas library -If you are using js-imagediff pelase drop us a line and let us know what you are doing with it. +If you are using js-imagediff please drop us a line and let us know what you are doing with it. Development ----------- @@ -94,7 +98,7 @@ npm test * `npm run test:serve` serves the specs at http://localhost:8085/spec/ to watch them run in a browser. * `IMAGEDIFF_LIBRARY=imagediff.min.js npm test` runs the same specs against a built file (a path from the repository root) instead of the source: through `require` in Node and as a `