Thursday, November 7, 2019

Java Diff Image and Highlight Differences


Motivation

I want to implement visual testing with Selenium.

There is already a library romankh3/image-comparison

but it says "with the same sizes" so probably not suitable in some cases.

Simple Note

Test file ImageDiff.java

Diff implementation ImageDiffImpl.java

Assume expected image aa.png and actual image cc.png
the diff result will be output_image.png

References

How do you clone a BufferedImage

calculating distance between a point and a rectangular box

Filling a Multidimensional Array using a Stream


1 comment: