rsmbl / Resemble.js

Image analysis and comparison
http://rsmbl.github.io/Resemble.js/
MIT License
4.5k stars 424 forks source link

Getting an error UnhandledPromiseRejectionWarning: TypeError: ImageData expected with images of different width #208

Closed ua834 closed 2 years ago

ua834 commented 3 years ago

When there is a diff and normalise function is being used I get this error. Happens with node v12.18.1 in Uubuntu 20.04.

packges: "@andreekeberg/imagedata": "^1.0.2", "pngjs": "^6.0.0", "resemblejs": "^3.2.5"

canvas version inside node_modules is "2.6.1"

my code:

`ar compare = async function(imgPath1, imgPath2){ return new Promise(async (resolve, reject) => { const img1 = getSync(imgPath1); const img2 = getSync(imgPath2);

resemble(img1)
.compareTo(img2)
// .scaleToSameSize()
// .ignoreColors()
.onComplete(function(data) {
    resolve(data);
});

}) }`

Images I've used for comparison:

f1 f2

jamescryer commented 2 years ago

It not clear what the error is. Worth updgrading to the latest Resenble which uses Canvas@2.8.0