{"id":28045,"library":"pixelhog","title":"pixelhog","description":"Rust-accelerated pixelmatch and SSIM for PNG bytes. Current version 1.2.0, active development, monthly releases.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/PostHog/pixelhog","tags":["image-comparison","pixelmatch","ssim","rust","png","diff"],"install":[{"cmd":"pip install pixelhog","lang":"bash","label":"PyPI install"}],"dependencies":[],"imports":[{"note":"ssim is a top-level function, not a submodule.","wrong":"import pixelhog.ssim","symbol":"ssim","correct":"from pixelhog import ssim"},{"note":"pixelmatch is also a top-level function.","wrong":"from pixelhog.diff import pixelmatch","symbol":"pixelmatch","correct":"from pixelhog import pixelmatch"},{"note":"","wrong":"","symbol":"Comparison","correct":"from pixelhog import Comparison"}],"quickstart":{"code":"from pixelhog import ssim, pixelmatch\n\npng_a = open('a.png', 'rb').read()\npng_b = open('b.png', 'rb').read()\n\n# Compare two PNGs and get diff image bytes\ndiff_png, score = pixelmatch(png_a, png_b)\nprint(f'SSIM: {ssim(png_a, png_b)}')","lang":"python","description":"Compare two PNG byte strings and get diff image plus SSIM score."},"warnings":[{"fix":"Use 'from pixelhog import pixelmatch' instead of 'from pixelhog.diff import pixelmatch'.","message":"Version 1.0.0 removed the legacy 'pixelhog.diff' module. All functions are now top-level.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use 'output_format' instead of 'format' when upgrading to 2.0.","message":"The 'webp_thumbnail' parameter in pixelmatch was added in 1.1.0, but the 'format' parameter is being replaced by 'output_format' in 2.0.","severity":"deprecated","affected_versions":">=1.1.0,<2.0.0"},{"fix":"Open files in binary mode and pass the bytes: open('img.png', 'rb').read()","message":"Input must be raw PNG bytes (bytes object), not file paths or PIL images.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use 'from pixelhog import pixelmatch' directly.","cause":"The 'pixelhog.diff' submodule was removed in 1.0.0.","error":"AttributeError: module 'pixelhog' has no attribute 'diff'"},{"fix":"Read the file as bytes: open('file.png', 'rb').read()","cause":"File path strings passed instead of PNG binary data.","error":"TypeError: expected bytes, not str"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}