--- id: pixelmatch version: "0.4.0" license: ISC license_treatment: permissive maintenance: active --- # pixelmatch — A pixel-level image comparison library. License: permissive · Maintenance: active · Downloads: 827.4K/mo ## What it is and what it does pixelmatch is a Python port of the Mapbox pixelmatch library, designed to detect pixel-level differences between two images. It implements anti-aliased pixel detection and perceptual color difference metrics based on published research papers, making it suitable for visual regression testing and screenshot comparison in automated tests. The library accepts images as raw RGBA pixel data and outputs the count of differing pixels while optionally generating a visual diff image. Key parameters control sensitivity via threshold (ranging from 0 to 1), anti-aliasing handling, and diff visualization options like pixel blending and masking. A contrib module provides additional integration patterns for image instances. Use it for: - Automated visual regression testing in UI test suites to detect unintended rendering changes - Screenshot comparison in end-to-end tests to verify application state visually - Batch image quality validation to flag images that deviate from expected reference images - Diff generation for visual debugging, highlighting exactly which pixels differ between two versions - Integration with CI/CD pipelines to fail builds when visual changes exceed acceptable thresholds ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Compares two images pixel-by-pixel to detect differences, with support for anti-aliased pixel detection and perceptual color metrics, returning a count of mismatched pixels and optionally generating a visual diff. Yes. Low install friction, no external dependencies, active maintenance, permissive ISC license, and no known vulnerabilities make it a safe choice. Well-suited for visual testing workflows; install if you need pixel-level image comparison or screenshot diffing in tests. ## Install pip install pixelmatch uv add pixelmatch poetry add pixelmatch ## Installing pixelmatch Before you install: Low friction: pure Python wheel with no runtime dependencies. Actively maintained as of 2026-03-07, with recent performance improvements in v0.4.0. Supports current Python versions (3.10–3.14). License in practice: ISC license is permissive, allowing use in commercial and proprietary projects with minimal restrictions. Quickstart: from pixelmatch import pixelmatch num_diff_pixels = pixelmatch(img1, img2, 800, 600, diff, threshold=0.1) Requires Python 3.10 or later. Images must have equal dimensions and be in RGBA format. Verify before relying: - Whether the contrib.PIL module requires an external image library as an optional dependency - Performance characteristics on very large images or batch comparisons ## Package facts - License: ISC (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 827.4K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pixel-level image comparison, screenshot diff detection, visual regression testing, image similarity matching, anti-aliased pixel detection, perceptual color difference, image diff output, image-comparison, visual-testing, regression-detection [View on SkillFed](https://skillfed.io/packages/pixelmatch) · [View on PyPI](https://pypi.org/project/pixelmatch/)