Open maurycyg opened 8 years ago
@maurycyg node-resemble-js
doesn't clip to 1200 px on my side. It can compare bigger images than that. Seeing your two images would help better understand the issue.
But I think your issue is because node-resemble-js
leaves the truncated part aside and do not take that part into account for the misMatchPercentage
. Which in my opinion is a mistake, because the size difference is still a difference that we should take into consideration.
@lksv , do you happen to know why it is the case?
Ah, I think it's because document
is not available in Node.js (only in the browser), so we can't use it to generate a canvas element (which is also unavailable in Node.js). node-resemble-js
uses canvas to normalize (via the normalise
function) the images' widths and heights.
So maybe a workaround would be to use node-canvas, but it depends on Cairo to be installed on the system. :-(
@lksv I personally need that same behaviour as the original resemble.js
, so do you want me to make a pull request, or do I need to fork a new repo?
BTW, thanks for making this awesome node module! Very appreciated! :)
I've two images and when I compare them in
node-resemble-js
I get this outputBut when I use the same two images on http://huddle.github.io/Resemble.js/ it tells me The second image is 97.49% different compared to the first. And they have different dimensions.
Update:
When set page.clipRect to a fixed size the percentage changed completely to just few percents. Resemblejs clips width and height of images to 1200 pixels for performance with
node-resemble-js
the pixels that exceeded the original image size were treated as similiar