[BUG] Same images are being considered different.
CrisFRC opened this issue · comments
Describe the bug
I did a test using the comparison method provided by the library, where I take a screenshot of two images that are exactly the same, but at different resolutions for a responsive test.
The scenario is as follows:
To Reproduce
BufferedImage expectedImage = ImageComparisonUtil.readImageFromResources("src/test/resources/data/p1.png");
BufferedImage actualImage = ImageComparisonUtil.readImageFromResources("src/test/resources/data/p1_1.png");
File resultDestination = new File( "src/test/resources/results/result2.png" );
//When
BufferedImage resizedExpectedImage = ImageComparisonUtil.resize(expectedImage,400,800);
BufferedImage resizedActualImage = ImageComparisonUtil.resize(actualImage,400,800);
ImageComparisonResult imageComparisonResult = new ImageComparison(resizedExpectedImage,
resizedActualImage).compareImages();
//Then
ImageComparisonUtil.saveImage(resultDestination, imageComparisonResult.getResult());
//And
assertEquals(MATCH, imageComparisonResult.getImageComparisonState());
Expected behavior
The images are exactly the same in terms of content, form and structure, so a MATCH is expected.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- Windows 11
- Chrome
** Screenshot ***
Image 1:
Image 2:
Result:
Additional context
The idea is that the coincidence of the images is based on the content or structure, but not on the size, because I understand that during the transformation, both suffer different deformations that do not allow them to coincide 100% in terms of pixels.
I hope to have an answer as to whether this comparison is possible or whether I am making a mistake in understanding or proceeding.
Thank you very much.