
Image Diff
com.pulsemcp由 pulsemcp.com 发布v0.1.3更新于 Oct 24, 2026
MCP server for programmatic image comparison and visual diff generation.
概览
一个本地 MCP 服务器,用于比较两张图片,返回结构化的像素差异统计、差异聚类和热力图。
- 可以做什么
- 比较两个本地图片文件,返回结构化差异结果:是否相同、像素数量与百分比、聚类数量及严重程度分布。查看差异区域聚类,包含边界框、像素数、强度指标和严重程度评级。通过颜色阈值、是否计入抗锯齿像素、最小聚类大小和聚类间距调节灵敏度,间距也可自动计算。比较尺寸不同的图片,较小图片会自动在大图中对齐,并报告对齐位置与置信度。获取生成的热力图和叠加合成图的文件路径以便查看。
- 适用场景
- 适用于视觉回归检查、将设计稿与渲染截图对比,或确认界面改动只产生了预期差异。当助手需要量化的、区域级的差异数据而非简单的相同与否时最合适。
- 运行要求
- 通过 npx 从 npm 包以本地进程方式运行。图片需以本地文件路径访问,支持 PNG、JPEG、WebP、TIFF 格式。未声明认证、环境变量或请求头。
安装
在 SourceWeft 中
- 打开 控制台中的 Image Diff,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
image-diff MCP Server
A Model Context Protocol (MCP) server for programmatic image comparison and visual diff generation. Compares two images pixel-by-pixel, identifies clusters of visual differences, and generates heatmap visualizations.
Designed for comparing design mock screenshots against actual UI implementations.
How It Works
- Pixel comparison using YIQ NTSC perceptual color distance (accounts for how humans perceive color differences)
- Anti-aliasing detection to filter out false positives from font smoothing and rounded corners
- Connected Component Labeling to group adjacent diff pixels into spatial clusters
- Natural-breaks clustering to auto-compute an optimal
cluster_gapusing nearest-neighbor distance analysis, merging nearby clusters into meaningful groups - Heatmap generation with yellow-to-red intensity gradient showing severity of differences
- Automatic alignment for different-sized images using OpenCV ZNCC template matching
Tools
get_diff_of_images
Compare two images and get structured diff results.
Parameters:
Returns:
identical: boolean indicating if images matchsummary: overall diff statistics (pixel counts, percentages, cluster count)clusters: array of diff regions with bounding boxes, severity ratings, and intensity metricsclustering: gap used, whether it was auto-computed, and suggested alternative gap valuesalignment(when images differ in size): position coordinates, confidence score, strategy used, and timingdimensions: width and height of the compared regionheatmapPath: file path to the generated heatmap imagecompositePath: file path to the heatmap overlaid on the source image
Requirements:
- Images must be accessible as local file paths
- Supports PNG, JPEG, WebP, TIFF input formats
- Images can have different dimensions — the smaller image is automatically aligned within the larger one
Tool Call Shape
MCP tool call input (minimal — just the two required paths):
MCP tool call input (with all optional parameters):
MCP response (same-size images with differences):
The text field contains the full JSON result as a string. When parsed, the full response shape looks like this:
Full parsed response shape (same-size images, with differences)
Full parsed response shape (identical images)
Full parsed response shape (different-size images — auto-alignment)
Note: The alignment field only appears when images have different dimensions. The dimensions field reflects the size of the compared region (the template size after alignment, not the full scene). The compositePath field is optional in the interface but always present when called via the MCP tool.
Examples
All examples below use this dashboard as the source image (800x600):
Example 1: Identical Images — No Differences
When two images are pixel-identical, the engine short-circuits and returns immediately.
The composite overlay shows the source image with no heatmap highlights — because there are no differences.
Structured output
Example 2: Color & Value Changes
The target has updated stat values ("12,847" -> "13,205", "$48,290" -> "$52,180") and different percentage text. The engine finds 11 clusters (auto gap=4) across the changed text and numbers.
The standalone heatmap shows only the diff pixels on a transparent background — yellow means lower intensity, red means higher intensity. The composite overlay blends the heatmap onto the source image so you can see exactly where differences occur in context.
Structured output (11 clusters, top 3 shown)
8 more clusters omitted.
Example 3: Font Change (sans-serif -> serif)
The entire page is re-rendered with a serif font (Georgia). Every text element shifts slightly, producing many glyph-level differences. With the default auto-gap, the engine computes an optimal cluster_gap=10 and merges these into 40 clusters representing distinct text blocks and UI regions.
The heatmap lights up across every text region — headers, stat values, table content, sidebar labels. Auto-gap merges nearby glyph fragments into meaningful groups.
Structured output — default auto-gap (40 clusters, top 3 shown)
37 more clusters omitted. Note: same diff pixels, same percentage — only the grouping changes.
What Auto-Gap Saves You From: cluster_gap=0
Without auto-gap, each glyph fragment becomes its own cluster. Setting cluster_gap=0 explicitly disables merging:
With cluster_gap=0, the 40 meaningful groups explode into 331 raw clusters — one for every individual character difference. This is what auto-gap saves you from.
Structured output with cluster_gap=0 (331 clusters, top 3 shown)
328 more clusters omitted. Note: same diff pixels, same percentage — only the grouping changes.
Example 4: Missing Elements (Badges Removed)
The target has status badges ("Complete", "Active") removed from the table — replaced with plain text. The engine detects 19 clusters (auto gap=4) precisely locating each removed badge.
The heatmap highlights each badge position where the colored pill was replaced with plain text.
Structured output (19 clusters, top 3 shown)
16 more clusters omitted.
Example 5: Layout Shift (Padding Change)
The target has increased padding and gaps on the stat cards — everything shifts down slightly. This produces 18 clusters (auto gap=18) because the auto-gap merges the many edge-level fragments caused by content repositioning.
Layout shifts light up the heatmap everywhere content has repositioned. The auto-gap merges the ripple effect into cohesive regions representing each shifted element.
Structured output (18 clusters, top 3 shown)
15 more clusters omitted.
Auto-Alignment: Comparing Different-Sized Images
When the source and target have different dimensions, the engine automatically finds where the smaller image (the "template") best matches within the larger one (the "scene"), crops that region, and runs the standard pixel-level comparison. No configuration needed.
How it works:
- Coarse search — OpenCV ZNCC (Zero-mean Normalized Cross-Correlation) template matching at downscaled resolution for fast candidate detection
- Fine refinement — Pixel-level ZNCC at full resolution around the coarse match for sub-pixel accuracy
- Crop & compare — The matched region is cropped from the scene and compared pixel-by-pixel against the template
This enables comparing a Figma component mock against a full-page screenshot directly — no manual cropping needed.
All alignment examples below use this dashboard as the source (scene) image (1024x768):
Auto-Align Example 1: Stats Card Mock vs Full Page
A Figma mock of the stats row (780x100) compared against the full page (1024x768). The mock has updated numbers ("12,847" -> "14,205", "$48,290" -> "$52,180", "3,847" -> "4,102") and different percentages.
The engine automatically locates the stats row at position (238, 80), crops that 780x100 region from the full page, and compares it against the mock.
The heatmap highlights exactly the changed stat values and percentages within the aligned region.
Structured output (15 clusters, top 3 shown)
12 more clusters omitted.
Key fields in the alignment object:
x,y— where the template was found in the scene (pixel coordinates)confidence— match quality (0-1, higher is better)strategy— algorithm used (opencv-zncc-hybrid)alignmentTimeMs— how long alignment tooktemplateImage— which image was the template ("target"means the target was smaller)originalDimensions— original sizes before alignment
Auto-Align Example 2: Sidebar Panel Mock vs Full Page
A Figma mock of the right sidebar (320x340) with modified progress values (78->85%, 92->95%, 45->62%) and a different button color (blue -> red). Compared against the full page.
The engine finds the sidebar at position (680, 212) with 99.3% confidence in 89ms, then identifies the changed progress bars and button.
The major cluster at the bottom is the button color change (blue -> red). The moderate clusters are the progress bar fill changes.
Structured output (7 clusters, top 3 shown)
4 more clusters omitted.
Auto-Align Example 3: Identical Crop — 0% Diff
An exact crop of the activity table (420x496) from the same full page screenshot. The engine finds the table at the exact position and confirms 0% diff — proving alignment precision.
Structured output
100% confidence, 0 diff pixels. The alignment found the exact position and the cropped region matches perfectly.
Alignment Performance
Cluster Severity Ratings
Each diff cluster is classified by severity based on pixel count and intensity:
Example Agent Skills
The example-skills/ directory contains ready-to-use Agent Skills that demonstrate how to build workflows on top of the image-diff MCP server.
implement-figma-design
An iterative design implementation skill that coordinates three MCP servers — Figma, Playwright, and image-diff — to build a UI component that matches a Figma design. The agent writes code, screenshots the running dev server, diffs against the Figma reference, diagnoses each diff cluster's root cause (color mismatch, typography, spacing, missing elements, etc.), applies fixes, and loops until the diff converges to <= 0.01%.
Pre-requisites: Figma MCP server, Playwright MCP server, image-diff MCP server, a working dev server.
To use: Copy example-skills/implement-figma-design/ into your project's .claude/skills/ directory (or equivalent skill location for your agent platform).
Credits
- Pixel comparison algorithm forked from pixelmatch by Mapbox (ISC License)
- Color distance based on "Measuring perceived color difference using YIQ NTSC transmission color space in mobile applications" by Y. Kotsarenko and F. Ramos
- Anti-aliasing detection based on "Anti-aliased Pixel and Intensity Slope Detector" by V. Vysniauskas, 2009
- Connected Component Labeling uses the classic two-pass algorithm with Union-Find
- Image alignment powered by opencv-wasm (Apache 2.0 License)
- Image I/O powered by sharp (Apache 2.0 License)
- Clustering approach inspired by looks-same by Gemini Testing (MIT License)
来源:productionized/image-diff/README.md,提交 0ed34de
工具
0版本历史
1- v0.1.3最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分