{"id":34841179,"url":"https://github.com/dknight/go-pixmatch","last_synced_at":"2026-05-23T11:38:42.716Z","repository":{"id":65177405,"uuid":"579757706","full_name":"dknight/go-pixmatch","owner":"dknight","description":"The simpliest and smallest pixel-level image comparator.","archived":false,"fork":false,"pushed_at":"2024-01-28T15:40:05.000Z","size":2428,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-27T02:08:01.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dknight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-18T20:20:42.000Z","updated_at":"2023-01-05T20:51:17.000Z","dependencies_parsed_at":"2024-01-28T16:35:35.068Z","dependency_job_id":null,"html_url":"https://github.com/dknight/go-pixmatch","commit_stats":{"total_commits":105,"total_committers":1,"mean_commits":105.0,"dds":0.0,"last_synced_commit":"6f3b356a1daeb1edc7d8e51b2430b210252f8972"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/dknight/go-pixmatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dknight%2Fgo-pixmatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dknight%2Fgo-pixmatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dknight%2Fgo-pixmatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dknight%2Fgo-pixmatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dknight","download_url":"https://codeload.github.com/dknight/go-pixmatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dknight%2Fgo-pixmatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33394668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-23T04:15:53.637Z","status":"ssl_error","status_checked_at":"2026-05-23T04:15:53.242Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-25T17:00:41.178Z","updated_at":"2026-05-23T11:38:42.697Z","avatar_url":"https://github.com/dknight.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pixmatch\n\n[![Tests](https://github.com/dknight/go-pixmatch/actions/workflows/tests.yml/badge.svg)](https://github.com/dknight/go-pixmatch/actions/workflows/tests.yml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/dknight/go-pixmatch)](https://goreportcard.com/report/github.com/dknight/go-pixmatch)\n[![Go Reference](https://pkg.go.dev/badge/github.com/dknight/go-pixmatch.svg)](https://pkg.go.dev/github.com/dknight/go-pixmatch)\n\n**pixmatch** is a pixel-level image comparison tool. Heavily inspired by\n[pixelmatch](https://github.com/mapbox/pixelmatch), but rewritten in idiomatic\nGo, **with zero dependencies,** to speed up images comparison.\nGo pixmatch has support for **PNG**, **GIF** and **JPEG** formats. This tool\nalso accurately detects anti-aliasing and may count it as a difference.\n\n## Example output\n\n| Format | Expected                                                                                         | Actual                                                                                           | Difference                                                                                          |\n| ------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- |\n| JPEG   | ![Hummingbird](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/bird-a.jpg)    | ![Hummingbird](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/bird-b.jpg)    | ![Hummingbird](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/bird-diff.jpg)    |\n| GIF    | ![Landscape](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/landscape-a.gif) | ![Landscape](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/landscape-b.gif) | ![Landscape](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/landscape-diff.gif) |\n| PNG    | ![Form](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/form-a.png)           | ![Form](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/form-b.png)           | ![Form](https://raw.githubusercontent.com/dknight/go-pixmatch/main/samples/form-aa-diff.png)        |\n\n## Install\n\nLibrary:\n\n```sh\ngo get -u github.com/dknight/go-pixmatch\n```\n\nCLI:\n\n```sh\ngo install github.com/dknight/go-pixmatch/cmd/pixmatch\n```\n\n## Library usage\n\n```go\nimg1, err := NewImageFromPath(\"./samples/form-a.png\")\nif err != nil {\n    log.Fatalln(err)\n}\nimg2, err := NewImageFromPath(\"./samples/form-b.png\")\nif err != nil {\n    log.Fatalln(err)\n}\n\n// Set some options.\noptions := NewOptions()\noptions.SetThreshold(0.05)\noptions.SetAlpha(0.5)\noptions.SetDiffColor(color.RGBA{0, 255, 128, 255})\n// etc...\n\ndiff, err := img1.Compare(img2, options)\nif err != nil {\n    log.Fatalln(err)\n}\n\nfmt.Println(diff)\n```\n\n## CLI usage\n\nUsage:\n\n```sh\npixmatch [options] image1.png image2.png\n```\n\nRun `pixmatch -h` for the list of supported options.\n\nExample command:\n\n```sh\npixmatch -o diff.png -aa -aacolor=00ffffff -mask ./samples/form-a.png ./samples/form-b.png\n```\n\n### Compile binaries\n\nHere is included simple script to compile binaries for some architectures.\nIf you need something special, you can easily adopt it for your needs.\n\n```sh\n./scripts/makebin.sh\n```\n\n## Testing and benchmark\n\nSimple tests:\n\n```sh\ngo test\n```\n\nTests with update diff images:\n\n```sh\nUPDATEDIFFS=1 go test\n```\n\nTests with full coverage:\n\n```sh\n# Terminal output\nUPDATEDIFFS=1 go test -cover\n\n# HTML output\nUPDATEDIFFS=1 go test -coverprofile c.out \u0026\u0026 go tool cover -html c.out\n```\n\nBenchmark scripts (outputFile will be written in `logs/` directory):\n\n```sh\n./scripts/benchmark.sh \u003coutputFile\u003e [iterations=10]\n```\n\nLater, it is easier to analyze it with a cool [benchstat](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat) tool.\n\n## Using with WASM\n\nWASI Preview 1 is very unstable, everything will be changed. This is\nan rough example how it might work with golang \u003c= 1.12.6.\n\nCompile the WASM file.\n\n\n```sh\ncd cmd/pixmatch\nGOOS=wasip1 GOARCH=wasm go build -o pixmatch.wasm main.go\n```\n\nNode.js exanoke file (index.js)\n\n```js\nconst fs = require('node:fs');\nconst {WASI} = require('node:wasi');\nconst imgs = ['form-a.png', 'form-b.png'];\nconst virtulPathWasiPath = '';\nconst wasi = new WASI({\n  version: 'preview1',\n  args: [virtulPathWasiPath, '-mask', '-o', 'diff.png', ...imgs],\n  preopens: {\n    '/': __dirname,\n  },\n});\n\nconst wasmBuffer = fs.readFileSync('./pixmatch.wasm');\nWebAssembly.instantiate(wasmBuffer, wasi.getImportObject()).then(\n  (wasmModule) =\u003e {\n    wasi.start(wasmModule.instance);\n  }\n);\n```\n\nRun node script:\n\n```sh\nNODE_NO_WARNINGS=1 node index.js\n```\n\n## Known issues, bugs, flaws\n\n- Anti-aliasing detection algorithm can be improved (help appreciated).\n- Because of the nature of the JPEG format, comparing them is not a good idea or play with `threshold` parameter.\n- I have not tested this tool for 64-bit color images.\n\n## Credits\n\n- To provide 100% compatibility with [pixelmatch](https://github.com/mapbox/pixelmatch).\n  Original test files are borrowed from [fixtures](https://github.com/mapbox/pixelmatch/tree/main/test/fixtures).\n- [Hummingbird](https://commons.wikimedia.org/wiki/File:Hummingbird.jpg) is taken from Wiki commons by San Diego Zoo.\n- Someone on the [Pixilart](https://www.pixilart.com/draw/16x16-6ec491154b5c687) platform created this pixel art girl.\n- Form screenshots are made using [PureCSS](https://purecss.io/) framework.\n\n## Contribution\n\nAny help is appreciated. Found a bug, typo, inaccuracy, etc.? Please do not hesitate to make a pull request or file an issue.\n\n## License\n\nMIT 2023\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdknight%2Fgo-pixmatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdknight%2Fgo-pixmatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdknight%2Fgo-pixmatch/lists"}