百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Q

qr-scanner-wechat

> 编程语言
开源

JS中的QR代码扫描仪,带有开放CV和WeChat的算法

400 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

JS中的QR代码扫描仪,带有开放CV和WeChat的算法

qr-scanner-wechat

QR Code scanner for JavaScript, based on a WebAssembly build of OpenCV and WeChat QR Code Scanner. Provides a much better detection rate and error tolerance.

Ported and rewritten from leidenglai/opencv-js-qrcode for modern browser build and easier usage. Huge thanks to @leidenglai for the previous work and research.

  • ️ Basic playground demo
  • ️ Anthony's QR Toolkit

Usage

bash
npm i qr-scanner-wechat
typescript
import { scan } from 'qr-scanner-wechat'

const result = await scan(canvas) // Or ImageElement

Upon the first call of scan, around 2.5MB gzipped of WebAssembly and models will be loaded asynchronously.

You can also preload them with:

typescript
import { ready, scan } from 'qr-scanner-wechat'

await ready()
const result = await scan(canvas)

Stream

In case you want to scan with streams like camera inputs, here is some code snippet for reference

xml
…

Node.js

It's also possible to do scanning on Node.js. To do so, you'll need some additional transformations to an ImageData-compatible format. We recommend using sharp and here is an example:

typescript
import { scan } from 'qrcode-openev-wechat'
import sharp from 'sharp'

const image = sharp('/path/to/image.png') // or Buffer, anything sharp supports

const { data, info } = await image
// .resize(1000) // you can resize first to improve the performance
  .ensureAlpha()
  .raw()
  .toBuffer({
    resolveWithObject: true,
  })

const result = await scan({
  data: Uint8ClampedArray.from(data),
  width: info.width,
  height: info.height,
})

console.log(result?.text)

Sponsors

License

MIT License © 2023 Anthony Fu

Issues· 2 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言