Add basic erosion morphological operation
Hey there :wave:
While comparing images produced by two different computers via WebGL, we noticed that sometimes the images would include 1px-2px thick spurious diff regions, likely caused by differences in rasterization and floating point precision between GPU models.
pixelmatch already includes antialias detection which helps alleviate some of these false-positives, but in some cases they were still showing up in our image diffs.
This PR introduces logic to optionally apply an erosion morphological operation after calculating the diff — which eliminates 1-2px wide structures from the image diff — and to return the total of non-eroded pixels.
Erosion is implemented as a separate pass, so it requires the output image to be present. By default eroded pixels are marked with an orange color.