{"id":13566128,"url":"https://github.com/seejohnrun/qr-scanner","last_synced_at":"2026-06-11T16:31:10.141Z","repository":{"id":66300767,"uuid":"278679184","full_name":"seejohnrun/qr-scanner","owner":"seejohnrun","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-15T07:12:36.000Z","size":101,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-19T18:40:58.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/seejohnrun.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":"2020-07-10T16:14:41.000Z","updated_at":"2021-07-12T13:57:04.000Z","dependencies_parsed_at":"2024-08-01T13:23:07.777Z","dependency_job_id":"21cd30cc-0c72-412e-8679-ae49b52811f5","html_url":"https://github.com/seejohnrun/qr-scanner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seejohnrun/qr-scanner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seejohnrun%2Fqr-scanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seejohnrun%2Fqr-scanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seejohnrun%2Fqr-scanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seejohnrun%2Fqr-scanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seejohnrun","download_url":"https://codeload.github.com/seejohnrun/qr-scanner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seejohnrun%2Fqr-scanner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34208761,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"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":[],"created_at":"2024-08-01T13:02:02.680Z","updated_at":"2026-06-11T16:31:10.112Z","avatar_url":"https://github.com/seejohnrun.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# QR Scanner\n\nJavascript QR Code Scanner based on [Cosmo Wolfe's javascript port](https://github.com/cozmo/jsqr) of [Google's ZXing library](https://github.com/zxing/zxing).\n\nIn this library, several improvements have been applied over the original port:\n\n- Lightweight: ~48.7 kB (~12.4 kB gzipped) minified with Google's closure compiler.\n- Improved performance and reduced memory footprint.\n- Runs in a WebWorker which keeps the main / UI thread responsive.\n- Can be configured for better performance on colored QR codes.\n\nAccording to [our benchmarking](https://github.com/danimoh/qr-scanner-benchmark) this project's scanner engine's detection rate is about 2-3 times (and up to 8 times) as high as the one of the most popular javascript QR scanner library [LazarSoft/jsqrcode](https://github.com/LazarSoft/jsqrcode). Also the other library oftentimes misreads the content of QR codes, while for this project no misreads occurred in the benchmarking.\n\nThe library supports scanning a continuous video stream from a web cam as well as scanning of single images.\n\nThe development of this library is sponsored by [nimiq](https://www.nimiq.com), world's first browser based blockchain.\n\n[\u003cimg src=\"https://nimiq.github.io/qr-scanner/nimiq_logo_rgb_horizontal.svg\" alt=\"nimiq.com\" width=\"250\"\u003e](https://nimiq.com)\n\n\n## Demo\nSee https://nimiq.github.io/qr-scanner/demo/\n\n## Installation\n\nTo install via npm:\n```bash\nnpm install --save qr-scanner\n```\nTo install via yarn:\n```bash\nyarn add qr-scanner\n```\nOr simply copy `qr-scanner.min.js` and `qr-scanner-worker.min.js` to your project.\n\n## Setup\n\nThe QR Scanner consists of two files.\n\n`qr-scanner.min.js` is the main API as an es6 module and can be imported as follows:\n```js\nimport QrScanner from 'path/to/qr-scanner.min.js'; // if using plain es6 import\nimport QrScanner from 'qr-scanner'; // if installed via package and bundling with webpack or rollup\n```\nThis requires the importing script to also be an es6 module or a module script tag, e.g.:\n```html\n\u003cscript type=\"module\"\u003e\n    import QrScanner from 'path/to/qr-scanner.min.js';\n    // do something with QrScanner\n\u003c/script\u003e\n```\n\n`qr-scanner-worker.min.js` is a plain Javascript file for the separate worker thread and needs to be copied over to your project. You should then point `QrScanner.WORKER_PATH` to where you put that file:\n```js\nQrScanner.WORKER_PATH = 'path/to/qr-scanner-worker.min.js';\n```\n\nIf you're using webpack to bundle your project, the file loader might be interesting for you to automatically copy the worker into your build:\n```js\nimport QrScannerWorkerPath from '!!file-loader!./node_modules/qr-scanner/qr-scanner-worker.min.js';\nQrScannerLib.WORKER_PATH = QrScannerWorkerPath;\n```\n\n## Usage\n\n### Web Cam Scanning\n\n#### 1. Create HTML\nCreate a `\u003cvideo\u003e` element where the web cam video stream should get rendered: \n```html\n\u003cvideo\u003e\u003c/video\u003e\n```\n\n#### 2. Create a QrScanner Instance\n```js\nconst qrScanner = new QrScanner(videoElem, result =\u003e console.log('decoded qr code:', result));\n```\nAs an optional third parameter a specific resolution that should be worked on can be specified. The default is 400.\n\nNote: to read from a Web Cam stream, your page must be served via HTTPS.\n\n\n### Single Image Scanning\n\n```js\nQrScanner.scanImage(image)\n    .then(result =\u003e console.log(result))\n    .catch(error =\u003e console.log(error || 'No QR code found.'));\n```\nSupported image sources are:\n[HTMLImageElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement),\n[SVGImageElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGImageElement),\n[HTMLVideoElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement),\n[HTMLCanvasElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement),\n[ImageBitmap](https://developer.mozilla.org/en-US/docs/Web/API/ImageBitmap),\n[OffscreenCanvas](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas),\n[File](https://developer.mozilla.org/en-US/docs/Web/API/File) / [Blob](https://developer.mozilla.org/en-US/docs/Web/API/Blob)\n\n\n### Color Inverted Mode\nThe scanner by default scans for dark QR codes on a bright background. You can change this behavior to scan for bright QR codes on dark background or for both at the same time:\n```js\nqrScanner.setInversionMode(inversionMode);\n```\nWhere `inversionMode` can be `original`, `invert` or `both`.\nThe default for web cam scanning is `original` and for single image scanning `both`.\n\n### Color Correction\nChange the weights for red, green and blue in the grayscale computation to improve contrast for QR codes of a\nspecific color:\n\n```js\nqrScanner.setGrayscaleWeights(red, green, blue, useIntegerApproximation = true);\n```\nWhere `red`, `green` and `blue` should sum up to 256 if `useIntegerApproximation === true` and `1` otherwise. By default, [these](https://en.wikipedia.org/wiki/YUV#Full_swing_for_BT.601) values are used.\n\n### Clean Up\n\nYou can destroy the QR scanner if you don't need it anymore:\n```js\nqrScanner.destroy();\nqrScanner = null;\n```\nThis will stop the camera stream and web worker and cleans up event listeners.\n\n## Build the project\nThe project is prebuild in qr-scanner.min.js in combination with qr-scanner-worker.min.js. Building yourself is only necessary if you want to change the code in\nthe /src folder. NodeJs is required for building.\n\nInstall required build packages:\n```batch\nnpm install\n```\n\nBuilding:\n```batch\nnpm run build\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseejohnrun%2Fqr-scanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseejohnrun%2Fqr-scanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseejohnrun%2Fqr-scanner/lists"}