Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Same images are being considered different. #244

Open
CrisFRC opened this issue Aug 29, 2023 · 0 comments
Open

[BUG] Same images are being considered different. #244

CrisFRC opened this issue Aug 29, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@CrisFRC
Copy link

CrisFRC commented Aug 29, 2023

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:
p1
Image 2:
p1_1
Result:
result2

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.

@CrisFRC CrisFRC added the bug Something isn't working label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants