lksv / node-resemble.js

LOOKING FOR MAINTAINER - Image analysis and comparison
MIT License
99 stars 37 forks source link

Diff Image getting generated intermittently #20

Open SimitTomar opened 8 years ago

SimitTomar commented 8 years ago

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.