dmtrKovalenko / odiff

The fastest pixel-by-pixel image visual difference tool in the world.
MIT License
1.96k stars 73 forks source link

Antialiasing is failing on tiny font differences #63

Closed Jorrex closed 1 year ago

Jorrex commented 1 year ago

Hi,

We're currently experiencing some issues with small differences in our images. These are always related to fonts that have a few pixels different. Although the config is passing antialiasing: true, it still fails the comparison.

To give some background, the base images are created on a Windows OS. The actual comparison is run through Cypress on a Linux VM.

I have taken the liberty to include the images that are causing these issues (base, screenshot & failure output). Zooming in on the base and the screenshot image shows how little difference there is on the fonts, but enough for the test to fail. image image_comparison.zip

As for the config that we use, it is simply the following snippet: compare(base, comp, diff, { threshold: 0.3, antialiasing: true })

dmtrKovalenko commented 1 year ago

Wow thanks for an awesome reproduction I will investigate this failure.

dmtrKovalenko commented 1 year ago

I spend some time looking at your issue and it looks like it is a completely legitimate failure according to the algorithm we are using https://www.researchgate.net/publication/234126755_Anti-aliased_Pixel_and_Intensity_Slope_Detector

image

For 7 points on the 100 I see more than 2 differenet pixels per the 3x3 block. Plus I see that the pixels itself are different because they are colored differently. AFAI can see this is a 2 different pixels.

image

Maybe you forget to make a grayscale?