Forum Discussion

sonya_m's avatar
sonya_m
SmartBear Alumni (Retired)
4 years ago
Solved

[TechCorner Challenge #12] Compare images using the Region Checkpoint

Hi TestComplete Community!   Dare to take the challenge?๐Ÿ™‚ By completing the tasks, you can practice your skills of working with TestComplete features and also get into the TechCorner Leaderboa...
  • anupamchampati's avatar
    4 years ago

    Task: Compare the two images below using TC Region Checkpoint ...and reveal a secret message! Post the message and the script to the comments.

     

    This is a solution created for [TechCorner Challenge #12]

     

    Secret message:

     

    function Test()

    {

       var pic2 = Utils.Picture;

       pic2.LoadFromFile('D:\\img2.png');

      Regions.img1_png.Check(pic2, false, false, 1, 1);

    }

     

    Result:

    Click here to show or modify data of the checkpoint "img1_png".

    The images are not equal.

    The pixel difference is 1 %.
    The color difference is 20 %.

    There is a slight difference between the compared images. If you want the checkpoint to report them as equal, set its Pixel Tolerance parameter to 277.

    Update the "img1_png" checkpoint data.

     

  • elanto's avatar
    4 years ago

    Task: Compare the two images below using TC Region Checkpoint ...and reveal a secret message! Post the message and the script to the comments.

     

    This is a solution created for [TechCorner Challenge #12]

     

    [DelphiScript]

    procedure comparingPictures();

    begin

    if Not Regions.img1_png.Check('img2_png') then

    Log.Message('Differ')

    end;

     

    Project Explorer:

    Workspace

     

    Results