rsmbl / Resemble.js

Image analysis and comparison

Home Page:http://rsmbl.github.io/Resemble.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this work with PNG?

mvsrgc opened this issue · comments

Does this lib. work with PNG?

let img1 = `data:image/png;base64,${fs.readFileSync(
    './foo.png',
    'base64'
)}`;
let img2 = `data:image/png;base64,${fs.readFileSync(
    './expected_foo.png',
    'base64'
)}`;

resemble(img1).compareTo(img2).onComplete(data => {
    console.log(data);
});

{ error: 'Error: Unsupported image type' }

Seems like there is a bug with data-uri PNG, from my limited testing it would appear the bug was introduced when I updated Resemble to use Canvas v2.6.0.

For now you can try downgading to resemble@3.2.0. Or use another technique for comparing images, such as the one described in this test

test("node buffers png", () => {