Forum Discussion

simonaferrara's avatar
simonaferrara
Frequent Contributor
5 years ago

How to compare image quite independent from screen resolution

Hi all,

 

I'm simply using Image comparison, through Regions Check method, to check if an image is equal to the one saved into Regions Store.

But I've issues if the screen resolution is different from the one when I've saved the image into Regions; for example: if the monitor is changed, I must use a different image (saved on a screen with the same resolution) to have the test passed.

How can I do a Image comparison in a way quite independent from the screen resolution? 

 

Thanks

Simona

 

  • TMbet's avatar
    TMbet
    Occasional Contributor

    Hi,

    If your images are based on coordinates:
    I think it's impossible. I have a lot of tests with the region checkpoints and the only thing you can do is set a proper resolution and DPI before testing. You should decide what display settings you'll use before the testing (it will be your testing environment) e.g. screen resolution 1080p and scale 125%.
    So you should use the same display settings on all testing machines. Another option probably is to configure your project to automatically change screen or browser resolution before you start running the tests.
    It's impossible to compare region checkpoints on different resolutions because once you change your resolution you change your coordinates too (that's because of pixel density)

    If your images are not based on coordinates:
    You can use the stretch method to resize your images https://support.smartbear.com/testcomplete/docs/reference/program-objects/picture/stretch.html 

    • simonaferrara's avatar
      simonaferrara
      Frequent Contributor

      Hi TMbet , how can I understand if my image is "based on coordinates"? 

      I've saved it to the Regions using the checkpoint feature of test script recording (it is a Web test, so the image is displayed on the browser).

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi Simona,

     

    Consider services like Applitools Eyes (accessible standalone and is integrated with SmartBear's CrossBrowserTesting (CBT)).

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you for a lot of great suggestions, Community!

       

      simonaferrara please mark the reply that helped you as a solution🙂