lksv / node-resemble.js

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

node-resemble cannot see the difference of two images #35

Closed yiqunliang closed 7 years ago

yiqunliang commented 7 years ago

I use CSS regression testig in WebdriverIO solution to test one of our Web product. There is a color change for one close icon, but seems node-resemble cannot see the difference, the comparing result is still passed.

pic-1 pic-2

mirzazeyrek commented 7 years ago

Hello yiqunliang,

I have tried the code in the examples and I couldn't reproduce the issue. Here is the created diff image:

issue-diff

I have copied the files you attached as issue-1.png and issue-2.png and changed the code in the example/example.js folder:

var resemble = require('../resemble.js'); var fs = require('fs');

resemble.outputSettings({ errorColor: { red: 155, green: 100, blue: 155 }, errorType: 'movement', transparency: 0.6 });

resemble('issue-1.png').compareTo('issue-2.png') .onComplete(function(data){ console.log(data); data.getDiffImage().pack().pipe(fs.createWriteStream('issue-diff.png')); });`

It seems like issue is related with your code. Did you changed something regarding to misMatchPercentage ?

yiqunliang commented 7 years ago

Hi mirzazeyrek,

I tried your steps, yes the diff file was created. However in my real case there is no diff file created. Then I try to update the config.js file, update the misMatchTolerance from 0 to 0.0001 then the diff file is created. I don't know why value 0 doesn't work. And thanks for your inspiration.

// config the webdrivercss folder function getWebdrivercss(fileName){

var folderPath={
    webdrivercss:
    {
        screenshotRoot: './screenshots/'+'/'+fileName+'/',
        failedComparisonsRoot: './failures/'+'/'+fileName+'/',
        misMatchTolerance: 0.0001,
        screenWidth: 1600

    }
}
return folderPath.webdrivercss

}

mirzazeyrek commented 7 years ago

Oh, glad to see that issue is resolved :)

Closing this since it doesn't look like a bug but a feature.