Screenshot Comparison Tool: Compare Two Screenshots in One Call

Compare two screenshots from your own scripts or AI agent. One call finds a small picture, compares it like a person, and gives a clear verdict.

By Ait Nohaila, Business Development Representative 16 min read

A screenshot comparison tool says whether a new picture of your application matches a reference. GUI Test Studio gives your scripts and AI agents one as a single call, compare_images, with a clear verdict and the pictures to prove it.

Your scripts already open the application and save screenshots. After that, either someone scrolls through them, or a strict comparison fails every morning because the text was drawn a little differently. In both cases, a wrong total can go unnoticed.

Who needs a screenshot comparison tool in their own tests?

This is for teams that already test their application, and want a reliable visual check without changing everything else. GUI Test Studio gives such a team its functions as tools. One of these tools, compare_images, needs no saved test.

What you already haveWhat you keepWhat the call adds
Scripts that drive the applicationYour scripts, your runner and your reportsA visual check where a picture matters
An AI agent that works on your codeThe agent and its other toolsA verdict that does not depend on the agent's own opinion of the picture
A testing factory, shared by several teamsIts stations and its pipelineThe same comparison and the same evidence for every team

To build a comparison like this in code, you would write and maintain the search for a small picture, the rules for small differences, and the evidence for each failure.Here, it is one call.If the idea of a shared line is new to you, read what a testing factory is.

What makes a screenshot comparison useful, or noisy?

The same screen is not always drawn with exactly the same pixels. Another graphics card, another version of a browser or smoother text can change many of them, while a person still sees the same thing. A comparison that fails on all of this is noisy, and the team soon stops reading its failures.

Should pass: nobody sees it

  • Text edges smoothed in another way
  • A shade too close to tell apart
  • A blinking text cursor

Should fail: a person would notice

  • A total of 49.00 in place of 94.00
  • A cart icon that is missing
  • Pay now that became Pay later
The useful question is not whether every pixel is the same. It is whether a person would see a difference.

The easy fix is to allow more differences, and it is risky.

  • A wrong digit changes only a tiny part of a large picture, so it can pass too.
  • GUI Test Studio compares the way a person looks, so it notices the wrong digit and ignores the smoothing.
A useful comparison fails when a person would see a difference, and only then.

Pixel-perfect screenshot testing explains this problem with examples.For the defects that functional checks do not see, read visual bugs your tests miss.

How does it filter noise and keep real regressions?

Definition

Noise changes many pixels a little, and people hardly notice it.

  • A regression can change very few pixels, and a person sees it at once.
  • So the number of changed pixels says little.
  • What matters is whether a person would notice.

GUI Test Studio applies this in four steps:

  1. 1

    It finds the element first

    If the whole element moved a little, it is found at its new place and compared there. Its move alone does not fail the comparison.

  2. 2

    It leaves out what nobody sees

    Smoothed edges, the coloured edges of screen text, a shade too close to tell apart and a lone blinking text cursor do not count.

  3. 3

    It judges each change where it is

    A change is never averaged over the whole picture. One wrong digit on a large page stands out as much as on a small one.

  4. 4

    It can ask AI about what is left

    This step is optional, and only for a difference.AI says in plain words what changed and whether it is minor, and you choose whether a minor one passes.Tell it what to ignore with ai_instructions, such as the date.

We tested it: noise against real bugs

We drew the same order card in several ways with real browsers, and added real bugs to it. Then we compared each picture with the reference, using the default settings and no AI.

Left: the reference. Middle: another screen colour profile changed 15.6 % of the pixels, and it passes. Right: the missing tick changed 0.03 %, and it fails.
What changedPixels changedVerdict
Another colour profile of the screen15.6 %Pass
The whole card moved a few pixels11.6 % at its old placePass
Text smoothed without colour2.3 %Pass
Drawn by the graphics card, not the processor2.3 %Pass
Pay now became Pay later0.31 %Fail
A capital letter was lost: pay now0.12 %Fail
One wrong digit in the total0.09 %Fail
The tick is missing0.03 %Fail

This was one card on one computer, so your figures will differ. Try it on your own screens before you rely on it.

What about different browsers, screens and computers?

Filtering has a limit. It leaves out small differences people do not notice, and keeps the ones they can see. Some browsers and screens really do draw the same page differently:

What is differentWhat we sawWhat to do
Microsoft Edge instead of ChromeThe same picture, because both use the same engine. It passes.One reference can serve both. Check it on your own pages.
Firefox instead of ChromeIts text, checkboxes and lists look different. It fails.Keep one reference for Firefox.
The screen at 125 % instead of 100 %Everything is larger. It is not found.Keep one reference per screen scaling.
A date, a name or an advert that changesIt is a real difference.Use a smaller reference without it, or tell the AI to ignore it.

Saved tests do this for you.Each browser and device keeps its own pictures, and baselines keep one expected picture for each Windows version, language or screen.

How to compare two screenshots with one call

compare_images is a tool of GUI Test Studio's MCP server.MCP is an open standard that lets one program use another one's tools.The program that calls the tool is a client: an AI assistant, or a short script of your own.

  1. 1

    Save a reference picture

    Take it when the application is right. Save it as a PNG file, and keep it with your tests. Someone who knows the screen should look at it first, because every later comparison relies on it.

  2. 2

    Connect to GUI Test Studio's MCP server

    It comes with GUI Test Studio.Connect your AI assistant, or let your own program start the server, as in the example below.

  3. 3

    Call compare_images

    Give it the reference picture and the new one. If you leave out the new one, it takes the screen as it is now.

  4. 4

    Act on the verdict

    Continue on pass. On any other verdict, stop and show the summary.

  5. 5

    Keep the files

    Give a folder in save_to.The pictures and the answer are written there, ready to attach to your build.

These are the arguments you will use most. Only the first one is required:

ArgumentWhat it is for
expectedThe reference picture: usually the full path of a PNG file.
actualThe new picture. Without it, the tool takes the screen as it is now.
strictnessHow strict the comparison is: relaxed, standard, strict or exact.Start with standard.
save_toThe full path of a folder for the pictures and the answer.
picturesWith false, the answer holds no picture.The files are still written to the folder.
ai_verificationWith true, AI takes a second look at a difference.It is off unless you ask for it.

Compare two pictures, in the guide, lists every argument with its default.

Compare screenshots in Python: a short example

This program uses the official MCP SDK for Python.It starts the server, compares one picture with its reference, and ends with an error when they do not match.Your pipeline step then fails too.

compare.py
# pip install "mcp>=2.3,<3"
import asyncio
from mcp import Client, StdioServerParameters

CONNECTOR = r"C:\Program Files\GUI Test Studio\Runner\gts-mcp.exe"

async def check_total(run_folder):
    async with Client(StdioServerParameters(command=CONNECTOR)) as studio:
        answer = await studio.call_tool("compare_images", {
            "expected": r"C:\baselines\checkout-total.png",
            "actual": run_folder + r"\checkout.png",
            "save_to": run_folder + r"\checkout-total",
        })
    if answer.is_error:
        raise RuntimeError(answer.content[0].text)
    result = answer.structured_content
    if not result["passed"]:
        raise SystemExit(result["summary"])

asyncio.run(check_total(r"C:\runs\1842"))

If the call itself is wrong, the answer says it is an error.

  • If the pictures differ, the call worked, and the verdict is fail.
  • The program checks both.
  • To compare many pictures, keep one connection open for all of them.

Official SDKs exist for other languages too.Call the tools from your own code explains what each answer holds.

How to find a small image in a full screenshot

A full screenshot is a poor reference, because any part of it can change for a good reason: a date, a name or an advert. Use a small picture of the part you care about, such as a button or a total. When that picture fits inside the new one, compare_images looks for it first.

The expected picture

Pay now

The full screenshot

BackPay now

Found here, then compared here

Only the part that was found is compared. The rest of the screenshot can change freely.

The tool says whether the picture was found, and never gives a score to interpret. If it was found, you get its place in the new picture. If it was not, the verdict is not_found, and there is nothing to compare.

The two sizesWhat happens
The sameThe two pictures are compared directly.
The reference fits inside the new pictureIt is looked for first. If it is found, that part is compared.
Any other caseThe verdict is error, with both sizes. Pictures are never stretched or cut to fit.

The answer your script or agent reads

The answer is structured data, so nothing has to be guessed from a sentence. Here is a short version of one. A total was found in a full screenshot, and it did not match its reference:

A shortened answer
{
  "verdict": "fail",
  "passed": false,
  "decidedBy": "verification",
  "search": {"found": true, "place": {"x": 812, "y": 440, "width": 320, "height": 80}},
  "files": {"folder": "C:\\runs\\1842\\checkout-total", "differences": "differences.png"}
}

There are four verdicts. Each one calls for something different:

VerdictWhat it meansWhat to do
passThe pictures match.Continue.
failThey differ.Look at the differences. Report a bug, or update the reference if the change was made on purpose.
not_foundThe reference is not in the new picture.Check that the application shows the right screen. The element may be missing, or look too different.
errorThe pictures cannot be compared.Read the summary. It names the problem, such as the two sizes.

The files that prove what the comparison saw

A red result without a picture means someone has to repeat the test by hand. With a folder in save_to, each comparison leaves its evidence:

Expected, actual, and where they differ. A person can decide in a few seconds.
FileWhat it holds
expected.pngThe reference picture that was used.
actual.pngThe new picture.
found.pngThe part that was found and compared, when the reference was looked for in a larger picture.
differences.pngOnly when the pictures differ: the compared part, with each difference outlined in red.
result.jsonThe whole answer, for your reports.

Use a new folder for each comparison, because a new comparison replaces the files of the last one in that folder. Attach the folder to your build, so that people can see what happened.

Do you need AI to compare screenshots?

No. The comparison itself uses no AI. For a second opinion on a difference, set ai_verification to true. The AI is asked only when the comparison found a difference, and never about a picture that passed.

It explains in plain words what changed, and its answer becomes the final verdict.You can give it instructions, such as ignoring the order number and the date.You also choose whether a minor difference passes or fails.If the AI does not answer, the result of the comparison stands.AI Smart Verification explains more.

Your choiceWho pays for the AIWhich AI sees a difference
No AIThere is nothing to pay, because no AI is called.None.
A cloud AIYou do: the AI provider bills your own key.The AI provider receives the pictures that differ.
A local model, one we provide or one you bringThere is no bill from a cloud AI provider. It uses the hardware it runs on.The model you chose, where it runs.

This is the AI that compare_images asks, chosen in the Preferences of that computer. If your own agent runs on a cloud AI, you pay its provider as before, even when ai_verification is off.

Where do the pictures go?

There are two questions here: whether the tool asks an AI, and who called the tool. People often forget the second one. With AI off, compare_images calls no AI and sends the pictures nowhere. But its answer also goes back to the program that called it. When the pictures differ, that answer includes a picture of the differences.

Who calls the tool, with AI offWhat happens to the pictures
A script on your computerThey stay on your computer, unless the script sends them somewhere.
A cloud AI assistantWhen the pictures differ, the assistant receives the picture of the differences. It shows a part of your screen or file, or all of it.
A cloud AI assistant, with pictures set to falseThe answer it receives holds no picture. The files in save_to are still written to your computer.

The same setting works for save_screenshot, the tool that saves a picture of the screen.An assistant that also takes its own screenshots still sees those.Data privacy in test automation covers the rest of your test data.

Visual testing through MCP: what to ask an AI agent

An agent can look at two screenshots and say that they look the same. Ask it to call compare_images instead, so that the result comes from a real comparison. It can also save a picture before a change, then look for it on the screen afterwards:

  1. Save

    The part you care about

  2. Change

    The agent edits the code

  3. Compare

    The saved picture with the screen

  • With GUI Test Studio, save a picture of the total on the invoice as C:\baselines\invoice-total.png. I will tell you when the new version is open. Then compare that picture with the screen, save the files to C:\runs\invoice-total, and tell me the verdict.
  • With GUI Test Studio, check that the picture C:\baselines\pay-button.png is in C:\runs\1842\checkout.png, and that it looks the same. Use no AI verification, and leave the pictures out of the answer.

This is a small part of what an agent can do with GUI Test Studio.It can also create, run and change whole tests, as MCP server for testing explains.If MCP is new to you, start with what MCP is in AI.

What to know before you start

What to knowWhat to do
The server runs on the computer that calls itInstall GUI Test Studio there, on a build machine too.
A picture is one momentWait until the screen is ready before you save it. The tool compares once, and does not wait for the screen.
Dates, names and numbers changeUse a small reference without them. You can also ask for AI, with instructions to ignore them.
Dark mode, languages and screen scaling change the pictureKeep one reference picture for each.
JPEG and WebP files are refusedSave your screenshots as PNG files.
A reference can be wrongHave a person look at it first, and again each time it changes.

When to use saved visual tests instead

One comparison answers one question, about one moment. Around it, your script still has to open the application, wait, click, choose the right reference and write a report. If more of your script goes into that than into the workflow, a saved test is easier to maintain.

What you needOne call to compare_imagesA saved test in GUI Test Studio
A workflow with several stepsYour script performs the steps.You record the steps, and the engine replays them.
The right momentYour script waits, then takes the picture.Each check waits for what it expects.
A value that changes, such as a dateLeave it out of the reference.A check can verify its format.
Dark mode or another languageYou manage one picture for each.One test holds a version for each.
A look that changed on purposeYou replace the reference file.You click Accept in the report, and you can undo it.
A person who reads the testThey read your script.They read a visual timeline.
ExampleA shop that uses both

The shop's own scripts already test the cart. The team adds one comparison, for the order total, and keeps everything else as it was. The refund is different: it crosses a website and a desktop application, and the refund rule is known to customer service.

The team records the refund as a saved test. Someone from customer service reads its checks on the timeline, and the pipeline runs it at every build.

GUI Test Studio is a testing solution where QA teams and AI agents build, execute, and manage tests visually, without code scripts.Its engine runs a saved test and verifies the application, with no call to an AI model.To try it, record a first test.

Key takeaways

  • 1Add one call, and keep everything else. It works with your own scripts, AI agents and pipeline.
  • 2Filter the noise, keep the bugs. Smoothing, shades and small moves pass.A wrong digit or a missing tick fails.
  • 3Keep one reference per browser. Add one for each screen scaling too, instead of loosening the comparison.
  • 4Use small reference pictures. The tool looks for them in the full screenshot, so the rest of the screen can change.
  • 5Test passed, and keep the files. Your script gets a clear answer, and people get the evidence.
  • 6AI is your choice. It is off unless you ask, and it looks only at differences: a cloud AI with your own key, or a local model, ours or your own.
  • 7Know who calls the tool. When the pictures differ, a cloud assistant receives a picture of the differences, unless you leave pictures out.

Questions

What is a screenshot comparison tool?

A screenshot comparison tool compares a picture of an application with a reference picture and says whether they match. A useful one notices what a person would notice, such as a wrong digit, and ignores small rendering differences nobody sees. It also shows where the pictures differ.

How do I compare two screenshots automatically?

Save a reference picture as a PNG file, then call a comparison tool from your test each time you take a new picture. With GUI Test Studio, the call is compare_images. Its verdict is pass, fail, not_found or error, and your script decides what to do with it.

How do you filter noise in screenshot comparison and keep real regressions?

Do not count the share of pixels that changed. In our test, another screen colour profile changed 15.6 % of an order card with nothing wrong, and a missing tick changed 0.03 %. GUI Test Studio compares the way a person looks: it passed the first and failed the second, with its default settings.

Can I compare screenshots from different browsers?

Keep one reference picture per browser. Microsoft Edge drew our test card exactly like Chrome, because both use the same engine. Firefox draws text and form controls in its own way, and its card failed. A looser setting let Firefox pass, but it also let a missing tick pass.

Can I look for a small image inside a full screenshot?

Yes. When the reference picture fits inside the new one, compare_images looks for it first and says whether it was found. If it was, the tool gives its place and compares that part only. A reference of one flat colour cannot be searched for.

Can an AI agent compare screenshots through MCP?

Yes. GUI Test Studio has an MCP server, and any program or assistant that can start a local MCP server can call compare_images. It needs no saved test, and the agent reads a structured answer with a clear verdict.

Do I need AI to compare two images?

No. The tool compare_images makes the comparison without AI, and calls no AI unless you ask for it. If you do, AI looks only at a difference, explains it, and gives the final verdict. You choose a cloud AI with your own key, or a local model, one we provide or one you bring.

Do my screenshots leave my computer?

It depends on who calls the tool and on whether you ask for AI. With AI off, compare_images calls no AI and sends the pictures nowhere, but when they differ, its answer includes a picture of the differences. If a cloud assistant made the call, it receives that picture, unless you set pictures to false.

Python is a trademark of its owner.

All articles