jsqr vs html5-qrcode vs qr-scanner vs qrcode-reader
웹 QR 코드 스캐너 라이브러리
jsqrhtml5-qrcodeqr-scannerqrcode-reader유사 패키지:

웹 QR 코드 스캐너 라이브러리

웹 QR 코드 스캐너 라이브러리는 QR 코드를 인식하고 해석하는 기능을 제공하는 패키지입니다. 이러한 라이브러리는 웹 애플리케이션에서 QR 코드를 쉽게 스캔하고 처리할 수 있도록 도와줍니다. 각 라이브러리는 고유한 기능과 성능을 제공하여 다양한 사용 사례에 적합합니다.

npm 다운로드 트렌드

3 년

GitHub Stars 순위

통계 세부사항

패키지
다운로드
Stars
크기
Issues
발행일
라이선스
jsqr7,243,7424,053-986年前Apache-2.0
html5-qrcode2,219,3666,2532.63 MB4534年前Apache-2.0
qr-scanner736,2212,904524 kB119-MIT
qrcode-reader128,785281-179年前Apache-2.0

기능 비교: jsqr vs html5-qrcode vs qr-scanner vs qrcode-reader

실시간 스캔 기능

  • jsqr:

    JSQR은 이미지 데이터에서 QR 코드를 빠르게 디코딩할 수 있지만, 실시간 스캔 기능은 제공하지 않습니다. 주로 이미지 파일에서 QR 코드를 추출하는 데 사용됩니다.

  • html5-qrcode:

    HTML5 QR Code는 웹캠을 통해 실시간으로 QR 코드를 스캔할 수 있는 기능을 제공합니다. 사용자가 카메라를 통해 QR 코드를 비추면 즉시 인식하여 결과를 반환합니다.

  • qr-scanner:

    QR Scanner는 비디오 스트림을 통해 실시간으로 QR 코드를 인식할 수 있으며, 모바일 환경에서의 성능이 뛰어나고 사용자 경험을 향상시킵니다.

  • qrcode-reader:

    QRCode Reader는 이미지 파일에서 QR 코드를 인식하는 데 중점을 두며, 실시간 스캔 기능은 제공하지 않습니다.

브라우저 호환성

  • jsqr:

    JSQR은 브라우저 호환성이 뛰어나지만, 특정 기능은 최신 브라우저에서만 지원될 수 있습니다.

  • html5-qrcode:

    HTML5 QR Code는 최신 브라우저에서 잘 작동하며, 모바일 및 데스크탑 환경 모두에서 사용할 수 있습니다.

  • qr-scanner:

    QR Scanner는 대부분의 현대 브라우저에서 잘 작동하며, 특히 모바일 브라우저에서 최적화되어 있습니다.

  • qrcode-reader:

    QRCode Reader는 다양한 브라우저에서 사용 가능하지만, 성능은 브라우저에 따라 다를 수 있습니다.

사용 용이성

  • jsqr:

    JSQR은 이미지 데이터에서 QR 코드를 인식하는 데 최적화되어 있지만, 사용법이 다소 복잡할 수 있습니다.

  • html5-qrcode:

    HTML5 QR Code는 간단한 API를 제공하여 개발자가 쉽게 사용할 수 있으며, 문서화가 잘 되어 있어 빠르게 시작할 수 있습니다.

  • qr-scanner:

    QR Scanner는 사용하기 쉬운 API를 제공하며, 실시간 스캔을 위한 설정이 간단합니다.

  • qrcode-reader:

    QRCode Reader는 다양한 이미지 포맷을 지원하지만, 사용법이 다른 라이브러리보다 복잡할 수 있습니다.

성능

  • jsqr:

    JSQR은 이미지 데이터에서 QR 코드를 빠르고 정확하게 인식하는 데 최적화되어 있어 성능이 우수합니다.

  • html5-qrcode:

    HTML5 QR Code는 실시간 스캔 성능이 뛰어나며, 다양한 환경에서 안정적으로 작동합니다.

  • qr-scanner:

    QR Scanner는 비디오 스트림을 통해 QR 코드를 인식할 때 성능이 뛰어나며, 모바일 환경에서 최적화되어 있습니다.

  • qrcode-reader:

    QRCode Reader는 이미지 파일에서 QR 코드를 인식하는 데 성능이 뛰어나지만, 실시간 스캔에서는 성능이 떨어질 수 있습니다.

지원하는 포맷

  • jsqr:

    JSQR은 QR 코드 형식에만 최적화되어 있으며, 다른 형식은 지원하지 않습니다.

  • html5-qrcode:

    HTML5 QR Code는 QR 코드 형식만 지원합니다.

  • qr-scanner:

    QR Scanner는 QR 코드 형식에 최적화되어 있으며, 다양한 QR 코드 변형을 지원합니다.

  • qrcode-reader:

    QRCode Reader는 QR 코드뿐만 아니라 다양한 이미지 포맷을 지원하여 유연성을 제공합니다.

선택 방법: jsqr vs html5-qrcode vs qr-scanner vs qrcode-reader

  • jsqr:

    JSQR은 QR 코드 디코딩에 최적화된 라이브러리로, 이미지 데이터에서 QR 코드를 빠르고 정확하게 인식해야 할 때 적합합니다.

  • html5-qrcode:

    HTML5 QR Code는 사용하기 쉽고 다양한 브라우저에서 지원되며, 카메라 접근을 통해 실시간으로 QR 코드를 스캔할 수 있는 기능이 필요할 때 선택하세요.

  • qr-scanner:

    QR Scanner는 비디오 스트림을 통해 QR 코드를 인식하는 데 중점을 두며, 모바일 환경에서의 성능이 우수합니다. 모바일 중심의 애플리케이션에 적합합니다.

  • qrcode-reader:

    QRCode Reader는 다양한 이미지 포맷을 지원하며, 서버 사이드에서 QR 코드 인식이 필요한 경우에 적합합니다.

jsqr의 README

jsQR

Build Status

A pure javascript QR code reading library. This library takes in raw images and will locate, extract and parse any QR code found within.

Demo

Installation

NPM

Available on npm. Can be used in a Node.js program or with a module bundler such as Webpack or Browserify.

npm install jsqr --save
// ES6 import
import jsQR from "jsqr";

// CommonJS require
const jsQR = require("jsqr");

jsQR(...);

Browser

Alternatively for frontend use jsQR.js can be included with a script tag

<script src="jsQR.js"></script>
<script>
  jsQR(...);
</script>

A note on webcams

jsQR is designed to be a completely standalone library for scanning QR codes. By design it does not include any platform specific code. This allows it to just as easily scan a frontend webcam stream, a user uploaded image, or be used as part of a backend Node.js process.

If you want to use jsQR to scan a webcam stream you'll need to extract the ImageData from the video stream. This can then be passed to jsQR. The jsQR demo contains a barebones implementation of webcam scanning that can be used as a starting point and customized for your needs. For more advanced questions you can refer to the getUserMedia docs or the fairly comprehensive webRTC sample code, both of which are great resources for consuming a webcam stream.

Usage

jsQR exports a method that takes in 3 arguments representing the image data you wish to decode. Additionally can take an options object to further configure scanning behavior.

const code = jsQR(imageData, width, height, options?);

if (code) {
  console.log("Found QR code", code);
}

Arguments

  • imageData - An Uint8ClampedArray of RGBA pixel values in the form [r0, g0, b0, a0, r1, g1, b1, a1, ...]. As such the length of this array should be 4 * width * height. This data is in the same form as the ImageData interface, and it's also commonly returned by node modules for reading images.
  • width - The width of the image you wish to decode.
  • height - The height of the image you wish to decode.
  • options (optional) - Additional options.
    • inversionAttempts - (attemptBoth (default), dontInvert, onlyInvert, or invertFirst) - Should jsQR attempt to invert the image to find QR codes with white modules on black backgrounds instead of the black modules on white background. This option defaults to attemptBoth for backwards compatibility but causes a ~50% performance hit, and will probably be default to dontInvert in future versions.

Return value

If a QR is able to be decoded the library will return an object with the following keys.

  • binaryData - Uint8ClampedArray - The raw bytes of the QR code.
  • data - The string version of the QR code data.
  • chunks - The QR chunks.
  • version - The QR version.
  • location - An object with keys describing key points of the QR code. Each key is a point of the form {x: number, y: number}. Has points for the following locations.
    • Corners - topRightCorner/topLeftCorner/bottomRightCorner/bottomLeftCorner;
    • Finder patterns - topRightFinderPattern/topLeftFinderPattern/bottomLeftFinderPattern
    • May also have a point for the bottomRightAlignmentPattern assuming one exists and can be located.

Because the library is written in typescript you can also view the type definitions to understand the API.

Contributing

jsQR is written using typescript. You can view the development source in the src directory.

Tests can be run with

npm test

Besides unit tests the test suite contains several hundred images that can be found in the /tests/end-to-end/ folder.

Not all the images can be read. In general changes should hope to increase the number of images that read. However due to the nature of computer vision some changes may cause images that pass to start to fail and visa versa. To update the expected outcomes run npm run-script generate-test-data. These outcomes can be evaluated in the context of a PR to determine if a change improves or harms the overall ability of the library to read QR codes. A summary of which are passing and failing can be found at /tests/end-to-end/report.json

After testing any changes, you can compile the production version by running

npm run-script build

Pull requests are welcome! Please create seperate branches for seperate features/patches.