node-resemble.js icon indicating copy to clipboard operation
node-resemble.js copied to clipboard

Diff Image getting generated intermittently

Open SimitTomar opened this issue 8 years ago • 0 comments

Hi,

I am trying to compare 2 images but the diff image is getting generated intermittently. Mentioned below is my code:

    var resemble = require('node-resemble-js');
    var fs = require('fs');

   function CompareImages(){

    var imgData1 = "C:\\Users\\stoma1\\Desktop\\ff1.png";
    var imgData2 = "C:\\Users\\stoma1\\Desktop\\ff2.png";


    resemble(imgData1).compareTo(imgData2).ignoreNothing().onComplete(function (data) {
        var png = data.getDiffImage().pack()
        png.pack().pipe(fs.createWriteStream('./diff.png'));

      });
    }

At times, when the diff.png gets generated its of 0 size, got the correct image with difference highlighted once.

SimitTomar avatar Apr 26 '16 19:04 SimitTomar