mapbox / pixelmatch

The smallest, simplest and fastest JavaScript pixel-level image comparison library
ISC License
6.15k stars 305 forks source link

Handle Chrome font rendering weirdness with "pixelShift" comparison #107

Open tybrd916 opened 2 years ago

tybrd916 commented 2 years ago

Hi @mourner ,

I can only imagine what your life is like right now in the midst of invasion! This is certainly not urgent, but I just wanted to document here...

I wanted to pose a question and propose a possible solution to the issue where Chrome and other browsers are often inconsistent in their anti-aliased font rendering like below output from latest pixelmatch:

image

A human can see "New Client" is shifted a few pixels up and over between the two screenshots, and might consider it within the threshold of "close enough - PASS". Anti-aliasing parameters don't seem to get it to filter out the false positive. So I forked your repo and made this pull request: https://github.com/mapbox/pixelmatch/pull/106