{"name":"pixelmatch","version":"7.1.1","keywords":["image","comparison","diff"],"author":{"name":"Volodymyr Agafonkin"},"license":"ISC","_id":"pixelmatch@7.1.1","maintainers":[{"name":"mapbox-npm-01","email":"accounts+npmjs-01@mapbox.com"},{"name":"mapbox-npm-02","email":"accounts+npmjs-02@mapbox.com"},{"name":"mapbox-npm-07","email":"accounts+npmjs-07@mapbox.com"},{"name":"mapbox-npm-03","email":"accounts+npmjs-03@mapbox.com"},{"name":"mapbox-npm-04","email":"accounts+npmjs-04@mapbox.com"},{"name":"mapbox-npm-09","email":"accounts+npmjs-09@mapbox.com"},{"name":"mapbox-npm-05","email":"accounts+npmjs-05@mapbox.com"},{"name":"mapbox-npm-06","email":"accounts+npmjs-06@mapbox.com"},{"name":"mapbox-npm-08","email":"accounts+npmjs-08@mapbox.com"},{"name":"mapbox-npm-advanced-actions","email":"accounts+npmjs-advanced-actions@mapbox.com"},{"name":"mapbox-npm-ci","email":"accounts+npmjs-npm-ci@mapbox.com"},{"name":"mapbox-npm","email":"accounts+npmjs@mapbox.com"},{"name":"mapbox-admin","email":"accounts@mapbox.com"},{"name":"mapbox-machine-user","email":"accounts+npm-mapbox-machine-user@mapbox.com"},{"name":"mbx-npm-ci-staging","email":"yannick.meeus+npm+staging+ci@mapbox.com"},{"name":"mbx-npm-ci-production","email":"yannick.meeus+npm+production+ci@mapbox.com"},{"name":"mbx-npm-01-production","email":"yannick.meeus+npm+prod+01@mapbox.com"},{"name":"mbx-npm-02-production","email":"yannick.meeus+npm+prod+02@mapbox.com"},{"name":"mbx-npm-03-production","email":"yannick.meeus+npm+prod+03@mapbox.com"},{"name":"mbx-npm-04-production","email":"yannick.meeus+npm+prod+04@mapbox.com"},{"name":"mbx-npm-05-production","email":"yannick.meeus+npm+prod+05@mapbox.com"},{"name":"mbx-npm-06-production","email":"yannick.meeus+npm+prod+06@mapbox.com"},{"name":"mbx-npm-07-production","email":"yannick.meeus+npm+prod+07@mapbox.com"},{"name":"mbx-npm-08-production","email":"yannick.meeus+npm+prod+08@mapbox.com"},{"name":"mbx-npm-09-production","email":"yannick.meeus+npm+prod+09@mapbox.com"},{"name":"mbx-npm-02-staging","email":"yannick.meeus@mapbox.com"},{"name":"mbx-npm-advanced-actions-staging","email":"yannick.meeus+npm+staging+advanced+actions@mapbox.com"},{"name":"mbx-npm-advanced-actions-production","email":"yannick.meeus+npm+prod+advanced+actions@mapbox.com"},{"name":"mourner","email":"agafonkin@gmail.com"}],"homepage":"https://github.com/mapbox/pixelmatch#readme","bugs":{"url":"https://github.com/mapbox/pixelmatch/issues"},"bin":{"pixelmatch":"bin/pixelmatch"},"dist":{"shasum":"5d63c2aba5a012d1fb5cb6a48653cf8fbd23fcd9","tarball":"http://registry-npm.ywwl.com/pixelmatch/download/pixelmatch-7.1.1.tgz","fileCount":6,"integrity":"sha512-ug6CkUcHtxn0umoaqV1VB9+h7IMxRgKQQ/fq4W7ahMnyzDSvQ0vsJRo6BC5s+Gv+RvpriWosDcGkI3L8+8Yxbw==","signatures":[{"sig":"MEYCIQCU73ATZS+NnEgMsF2CwwAORcDQpzIP+PipbUq3wwwceQIhALtxIWmqo+kCxXwrtWDC3n+Aa2wEB+I4T6a5Rc33L8fW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20792,"size":6675,"noattachment":false,"key":"/pixelmatch/-/pixelmatch-7.1.1.tgz"},"main":"index.js","type":"module","types":"index.d.ts","gitHead":"973afc76ad1f609261a6b3b503d341e9ed9056e4","scripts":{"test":"tsc && node --test","pretest":"eslint"},"_npmUser":{"name":"mbx-npm-02-production","email":"yannick.meeus+npm+prod+02@mapbox.com"},"repository":{"url":"git+https://github.com/mapbox/pixelmatch.git","type":"git"},"_npmVersion":"11.3.0","description":"The smallest and fastest pixel-level image comparison library.","directories":{},"_nodeVersion":"20.15.1","dependencies":{"pngjs":"^7.0.0"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^10.2.1","typescript":"^6.0.3","eslint-config-mourner":"^4.1.0"},"_npmOperationalInternal":{"tmp":"tmp/pixelmatch_7.1.1_1777391607275_0.3198168875492371","host":"s3://npm-registry-packages-npm-production"},"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<script type=\"module\">\n\timport pixelmatch from 'https://esm.run/pixelmatch';\n```\n\n## [Changelog](https://github.com/mapbox/pixelmatch/releases)\n","publish_time":1777391607407,"_cnpm_publish_time":1777391607407,"dist-tags":{"latest":"8.0.0"}}