Open aymen3redlean opened 5 years ago
@aymen3redlean could you please provide more details? what is actual reason of the mismatch in your case?
Hello, According to the comparison, there are some pixels were be shifted from their original positions. Is there a way to ignored this case and say that the two images are same?
@aymen3redlean do you have any idea why pixels are shifted? also could you please post the code you use to compare images?
The screenshots are the same but taken in different time which can be the origin of the shift.
Please find in below the comparison code:
try {
ImageDiffer imgDiff = new ImageDiffer();
ImageDiff imageResult = imgDiff.makeDiff(
ImageIO.read(new File(RunFolderPath + "\\" + imageTabName + "_1_" + level + ".png")),
ImageIO.read(new File(RunFolderPath + "\\" + imageTabName + "_2_" + level + ".png")));
if (imageResult.hasDiff()) {
BufferedImage y = imageResult.getMarkedImage();
ImageIO.write(y, "PNG", new File(imageTabName + "_diff.png"));
}
} catch (Exception e) {
new Exception();
}
@aymen3redlean you can try changing the value of diff size trigger:
PointsMarkupPolicy diffMarkupPolicy = new PointsMarkupPolicy();
diffMarkupPolicy.setDiffSizeTrigger(<put_your_value_here>);
ImageDiffer imgDiff = new ImageDiffer().withDiffMarkupPolicy(diffMarkupPolicy);
...
I am facing the same issue, how should we use setDiffSizeTrigger, is there any threshold to comparison we can give, like fail if 90% of image doesn't match, right now it fails even if the text shifts a bit
Hello,
we use ashot in selenium project to compare two images in a specific test case.
In same case, the image are the same but image comparison fails due to Mismatched pixels
Is the any way to fix this? Or to reduce sensibility in image comparison?