|
|
@ -118,8 +118,10 @@ npm install canvas |
|
|
|
The API under Node is the same as on the browser with one addition, a promise based `compareImage` convenience function that is used as follows: |
|
|
|
The API under Node is the same as on the browser with one addition, a promise based `compareImage` convenience function that is used as follows: |
|
|
|
|
|
|
|
|
|
|
|
``` js |
|
|
|
``` js |
|
|
|
const compareImage = require('resemblejs/compareImages'); |
|
|
|
const compareImages = require('resemblejs/compareImages'); |
|
|
|
|
|
|
|
const fs = require("fs"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function getDiff(){ |
|
|
|
// The parameters can be Node Buffers |
|
|
|
// The parameters can be Node Buffers |
|
|
|
// data is the same as usual with an additional getBuffer() function |
|
|
|
// data is the same as usual with an additional getBuffer() function |
|
|
|
const data = await compareImages( |
|
|
|
const data = await compareImages( |
|
|
@ -128,6 +130,11 @@ const data = await compareImages( |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
fs.writeFileSync('./output.png', data.getBuffer()); |
|
|
|
fs.writeFileSync('./output.png', data.getBuffer()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getDiff(); |
|
|
|
|
|
|
|
|
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
#### Tests |
|
|
|
#### Tests |
|
|
|