Skip to main content
Glama

Compare two images

ai_image_diff
Read-onlyIdempotent

Compare two images pixel by pixel and write a diff PNG with changed pixels in red over a faded reference; returns difference count and percentage for visual regression checks.

Instructions

Compare two images pixel by pixel (pixelmatch, anti-aliasing aware) and write a diff PNG with changed pixels in red over a faded copy of the first image. Returns the number and percentage of different pixels. Images must be the same size unless resize is true (the second is stretched to the first's size). Reads PNG, JPEG, WebP, AVIF, GIF (first frame), TIFF and SVG; file path or base64; up to 50 MP. Good for visual regression checks.

Input Schema

NameRequiredDescriptionDefault
aYesThe first (reference) image: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI).
bYesThe second image: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI).
outputNoWhere to write the result: a file path, or a folder ending in "/". Default: the server output folder (a temp folder unless --out-dir is set).
resizeNoResize the second image to the first one's size when they differ (otherwise that is an error).
includeAANoCount anti-aliased edge pixels as differences too. Default false.
thresholdNoColour difference tolerance 0..1; smaller is stricter. Default 0.1.
returnBase64NoAlso return the output as base64 in the result (only for small files). Default false.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

On its own the description is unusually transparent: it discloses that a diff PNG is written with red-diff over a faded reference, that pixel count and percentage are returned, and that inputs must match in size unless resize is true. But it explicitly describes a filesystem write while annotations declare readOnlyHint=true and idempotentHint=true, which is a material inconsistency for an agent deciding whether this call has side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One dense paragraph with essentially no waste and the core operation front-loaded; format and size limits follow in a logical order. Slightly run-on, packing formats, size limits and use case into a stream rather than separated cues.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description correctly carries the return info (different-pixel count and percentage) and the artifact produced (diff PNG). A couple of details an agent might want are absent, such as the returned path of the diff file and error behavior when sizes mismatch, but nothing critical is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3, but the description adds real semantics beyond the schema: it explains that resize stretches the second image to the first's size, that anti-aliasing awareness is default behavior unless includeAA, and that inputs may be paths or base64 within a 50 MP cap. It does not cover threshold or output/returnBase64 behavior, so not a 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Compare two images pixel by pixel') and immediately names the underlying algorithm and output artifact (pixelmatch diff PNG). It is unambiguously distinct from siblings like text_diff, image_convert or image_resize.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The closing sentence 'Good for visual regression checks' gives a concrete use case, and the size/resize constraint tells the agent when it can and cannot be called. It stops short of naming an alternative tool for non-visual comparisons, so a 4 rather than 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools