{"id":13394580,"url":"https://github.com/mapbox/pixelmatch","last_synced_at":"2025-09-09T20:47:13.414Z","repository":{"id":37335732,"uuid":"44182157","full_name":"mapbox/pixelmatch","owner":"mapbox","description":"The smallest, simplest and fastest JavaScript pixel-level image comparison library","archived":false,"fork":false,"pushed_at":"2025-07-16T08:16:41.000Z","size":2091,"stargazers_count":6514,"open_issues_count":15,"forks_count":315,"subscribers_count":168,"default_branch":"main","last_synced_at":"2025-08-08T19:01:35.718Z","etag":null,"topics":["diff","image-comparison","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mapbox.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,"zenodo":null}},"created_at":"2015-10-13T14:31:23.000Z","updated_at":"2025-08-08T01:05:25.000Z","dependencies_parsed_at":"2024-06-18T10:54:13.524Z","dependency_job_id":"30226683-af58-4e45-8c14-fe0e8f2509d1","html_url":"https://github.com/mapbox/pixelmatch","commit_stats":{"total_commits":108,"total_committers":12,"mean_commits":9.0,"dds":"0.11111111111111116","last_synced_commit":"741803bc9cf30e436f4d94459b2fe5e0e6dd8008"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/mapbox/pixelmatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fpixelmatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fpixelmatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fpixelmatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fpixelmatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mapbox","download_url":"https://codeload.github.com/mapbox/pixelmatch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mapbox%2Fpixelmatch/sbom","scorecard":{"id":616597,"data":{"date":"2025-08-11","repo":{"name":"github.com/mapbox/pixelmatch","commit":"14419e81cd24ccefc470799d3255d4e18acf6310"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.5,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":4,"reason":"Found 12/25 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":4,"reason":"3 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:8: update your workflow using https://app.stepsecurity.io/secureworkflow/mapbox/pixelmatch/node.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/mapbox/pixelmatch/node.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/node.yml:17","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: ISC License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":10,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/mapbox/.github/SECURITY.md:1","Info: Found linked content: github.com/mapbox/.github/SECURITY.md:1","Info: Found disclosure, vulnerability, and/or timelines in security policy: github.com/mapbox/.github/SECURITY.md:1","Info: Found text in security policy: github.com/mapbox/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'main'","Warn: 'stale review dismissal' is disabled on branch 'main'","Warn: required approving review count is 1 on branch 'main'","Warn: codeowners review is not required on branch 'main'","Warn: 'last push approval' is disabled on branch 'main'","Warn: no status checks found to merge onto branch 'main'","Info: PRs are required in order to make changes on branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":6,"reason":"SAST tool is not run on all commits -- score normalized to 6","details":["Warn: 11 commits out of 17 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T04:10:26.868Z","repository_id":37335732,"created_at":"2025-08-21T04:10:26.868Z","updated_at":"2025-08-21T04:10:26.868Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274359027,"owners_count":25270683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["diff","image-comparison","testing-tools"],"created_at":"2024-07-30T17:01:24.458Z","updated_at":"2025-09-09T20:47:13.402Z","avatar_url":"https://github.com/mapbox.png","language":"JavaScript","readme":"# pixelmatch\n\n[![Node](https://github.com/mapbox/pixelmatch/actions/workflows/node.yml/badge.svg)](https://github.com/mapbox/pixelmatch/actions/workflows/node.yml)\n[![](https://img.shields.io/badge/simply-awesome-brightgreen.svg)](https://github.com/mourner/projects)\n\nThe smallest, simplest and fastest JavaScript pixel-level image comparison library,\noriginally created to compare screenshots in tests.\n\nFeatures accurate **anti-aliased pixels detection**\nand **perceptual color difference metrics**.\n\nInspired by [Resemble.js](https://github.com/Huddle/Resemble.js)\nand [Blink-diff](https://github.com/yahoo/blink-diff).\nUnlike these libraries, pixelmatch is around **150 lines of code**,\nhas **no dependencies**, and works on **raw typed arrays** of image data,\nso it's **blazing fast** and can be used in **any environment** (Node or browsers).\n\n```js\nconst numDiffPixels = pixelmatch(img1, img2, diff, 800, 600, {threshold: 0.1});\n```\n\nImplements ideas from the following papers:\n\n- [Measuring perceived color difference using YIQ NTSC transmission color space in mobile applications](https://www.spiedigitallibrary.org/conference-proceedings-of-spie/8011/80119D/Simple-perceptual-color-space-for-color-specification-and-real-time/10.1117/12.901997.full) (2010, Yuriy Kotsarenko, Fernando Ramos)\n- [Anti-aliased pixel and intensity slope detector](https://www.researchgate.net/publication/234126755_Anti-aliased_Pixel_and_Intensity_Slope_Detector) (2009, Vytautas Vyšniauskas)\n\n## [Demo](https://observablehq.com/@mourner/pixelmatch-demo)\n\n## Example output\n\n| expected | actual | diff |\n| --- | --- | --- |\n| ![](test/fixtures/4a.png) | ![](test/fixtures/4b.png) | ![1diff](test/fixtures/4diff.png) |\n| ![](test/fixtures/3a.png) | ![](test/fixtures/3b.png) | ![1diff](test/fixtures/3diff.png) |\n| ![](test/fixtures/6a.png) | ![](test/fixtures/6b.png) | ![1diff](test/fixtures/6diff.png) |\n\n## API\n\n### pixelmatch(img1, img2, output, width, height[, options])\n\n- `img1`, `img2` — Image data of the images to compare (`Buffer`, `Uint8Array` or `Uint8ClampedArray`). **Note:** image dimensions must be equal.\n- `output` — Image data to write the diff to, or `null` if don't need a diff image.\n- `width`, `height` — Width and height of the images. Note that _all three images_ need to have the same dimensions.\n\n`options` is an object literal with the following properties:\n\n- `threshold` — Matching threshold, ranges from `0` to `1`. Smaller values make the comparison more sensitive. `0.1` by default.\n- `includeAA` — If `true`, disables detecting and ignoring anti-aliased pixels. `false` by default.\n- `alpha` — Blending factor of unchanged pixels in the diff output. Ranges from `0` for pure white to `1` for original brightness. `0.1` by default.\n- `aaColor` — The color of anti-aliased pixels in the diff output in `[R, G, B]` format. `[255, 255, 0]` by default.\n- `diffColor` — The color of differing pixels in the diff output in `[R, G, B]` format. `[255, 0, 0]` by default.\n- `diffColorAlt` — An alternative color to use for dark on light differences to differentiate between \"added\" and \"removed\" parts. If not provided, all differing pixels use the color specified by `diffColor`. `null` by default.\n- `diffMask` — Draw the diff over a transparent background (a mask), rather than over the original image. Will not draw anti-aliased pixels (if detected).\n\nCompares two images, writes the output diff and returns the number of mismatched pixels.\n\n## Command line\n\nPixelmatch comes with a binary that works with PNG images:\n\n```bash\npixelmatch image1.png image2.png output.png 0.1\n```\n\n## Example usage\n\n### Node.js\n\n```js\nimport fs from 'fs';\nimport {PNG} from 'pngjs';\nimport pixelmatch from 'pixelmatch';\n\nconst img1 = PNG.sync.read(fs.readFileSync('img1.png'));\nconst img2 = PNG.sync.read(fs.readFileSync('img2.png'));\nconst {width, height} = img1;\nconst diff = new PNG({width, height});\n\npixelmatch(img1.data, img2.data, diff.data, width, height, {threshold: 0.1});\n\nfs.writeFileSync('diff.png', PNG.sync.write(diff));\n```\n\n### Browsers\n\n```js\nconst img1 = img1Context.getImageData(0, 0, width, height);\nconst img2 = img2Context.getImageData(0, 0, width, height);\nconst diff = diffContext.createImageData(width, height);\n\npixelmatch(img1.data, img2.data, diff.data, width, height, {threshold: 0.1});\n\ndiffContext.putImageData(diff, 0, 0);\n```\n\n## Install\n\nInstall with NPM:\n\n```bash\nnpm install pixelmatch\n```\n\nOr use in the browser from a CDN:\n\n```html\n\u003cscript type=\"module\"\u003e\n\timport pixelmatch from 'https://esm.run/pixelmatch';\n```\n\n## [Changelog](https://github.com/mapbox/pixelmatch/releases)\n","funding_links":[],"categories":["JavaScript","Repository","Web Development","others","Geospatial Library","Image Processing","工具","\u003e 5K ⭐️"],"sub_categories":["Image","C++/C Toolkit","JavaScript","React Components","调试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fpixelmatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmapbox%2Fpixelmatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmapbox%2Fpixelmatch/lists"}