jsqr vs react-qr-code vs qr.js vs qr-image vs qrious
QR 코드 생성 및 스캔 라이브러리
jsqrreact-qr-codeqr.jsqr-imageqrious유사 패키지:

QR 코드 생성 및 스캔 라이브러리

QR 코드 생성 및 스캔 라이브러리는 웹 애플리케이션에서 QR 코드를 생성하거나 스캔하는 기능을 제공합니다. 이러한 라이브러리는 제품 정보, URL, 연락처 정보 등을 빠르게 공유할 수 있는 방법을 제공합니다. jsqr는 QR 코드를 스캔하는 데 특화된 라이브러리이며, qr-image는 서버 측에서 QR 코드를 이미지로 생성하는 데 사용됩니다. qr.js는 클라이언트 측에서 QR 코드를 생성하는 간단한 라이브러리이고, qrious는 QR 코드 생성에 대한 더 많은 옵션과 스타일링 기능을 제공합니다. react-qr-code는 React 애플리케이션에서 QR 코드를 쉽게 생성할 수 있는 컴포넌트 기반 라이브러리입니다.

npm 다운로드 트렌드

3 년

GitHub Stars 순위

통계 세부사항

패키지
다운로드
Stars
크기
Issues
발행일
라이선스
jsqr7,100,6194,053-986年前Apache-2.0
react-qr-code3,981,28089519.9 kB85ヶ月前MIT
qr.js2,439,429---14年前MIT
qr-image368,2491,064-1510年前MIT
qrious93,7461,616-449年前GPL-3.0

기능 비교: jsqr vs react-qr-code vs qr.js vs qr-image vs qrious

QR 코드 생성

  • jsqr:

    jsqr는 QR 코드 생성 기능을 제공하지 않습니다. 이 라이브러리는 QR 코드를 스캔하고 디코딩하는 데 특화되어 있습니다.

  • react-qr-code:

    react-qr-code는 React 컴포넌트로 QR 코드를 생성할 수 있습니다. 크기, 색상, 배경 등을 조절할 수 있는 다양한 속성을 제공합니다.

  • qr.js:

    qr.js는 클라이언트 측에서 간단한 QR 코드를 생성할 수 있는 기능을 제공합니다. 이 라이브러리는 빠르고 가벼우며, 외부 종속성 없이 사용할 수 있습니다.

  • qr-image:

    qr-image는 서버 측에서 QR 코드를 생성할 수 있는 기능을 제공합니다. PNG, SVG, PDF 등 다양한 형식으로 QR 코드를 생성할 수 있습니다.

  • qrious:

    qrious는 QR 코드 생성에 대한 더 많은 옵션을 제공합니다. 크기, 색상, 배경 등을 조절할 수 있어 더 스타일리시한 QR 코드를 만들 수 있습니다.

QR 코드 스캔

  • jsqr:

    jsqr는 QR 코드를 스캔하고 디코딩하는 기능을 제공합니다. 이 라이브러리는 이미지나 비디오 스트림에서 QR 코드를 인식할 수 있습니다.

  • react-qr-code:

    react-qr-code는 QR 코드 스캔 기능을 제공하지 않습니다. 이 라이브러리는 QR 코드 생성에만 사용됩니다.

  • qr.js:

    qr.js는 QR 코드 스캔 기능을 제공하지 않습니다. 이 라이브러리는 QR 코드 생성에만 사용됩니다.

  • qr-image:

    qr-image는 QR 코드 스캔 기능을 제공하지 않습니다. 이 라이브러리는 QR 코드 생성에만 특화되어 있습니다.

  • qrious:

    qrious는 QR 코드 스캔 기능을 제공하지 않습니다. 이 라이브러리는 QR 코드 생성에만 사용됩니다.

커스터마이징

  • jsqr:

    jsqr는 커스터마이징 기능이 없습니다. 이 라이브러리는 QR 코드 스캔에 집중되어 있습니다.

  • react-qr-code:

    react-qr-code는 React 컴포넌트로서 다양한 커스터마이징이 가능합니다. 크기, 색상, 배경 등을 쉽게 조절할 수 있습니다.

  • qr.js:

    qr.js는 커스터마이징 기능이 거의 없습니다. 기본적인 QR 코드 생성 기능만 제공합니다.

  • qr-image:

    qr-image는 QR 코드 생성 시 일부 커스터마이징이 가능합니다. 색상, 크기 등을 조절할 수 있지만, 제한적입니다.

  • qrious:

    qrious는 커스터마이징 기능이 뛰어납니다. 크기, 색상, 배경 등을 자유롭게 조절할 수 있어 더 스타일리시한 QR 코드를 만들 수 있습니다.

React 통합

  • jsqr:

    jsqr는 React와 직접적인 통합 기능이 없습니다. 그러나 JavaScript 라이브러리로서 React 프로젝트에 쉽게 통합할 수 있습니다.

  • react-qr-code:

    react-qr-code는 React 전용 라이브러리로, React 애플리케이션에 쉽게 통합할 수 있습니다. 컴포넌트 기반으로 설계되어 있어 사용이 간편합니다.

  • qr.js:

    qr.js는 React와 직접적인 통합 기능이 없습니다. 그러나 클라이언트 측 라이브러리로서 React 컴포넌트 내에서 사용할 수 있습니다.

  • qr-image:

    qr-image는 서버 측 라이브러리로, React와 직접적인 통합 기능은 없습니다. 그러나 API를 통해 React 애플리케이션과 연동할 수 있습니다.

  • qrious:

    qrious는 React와 직접적인 통합 기능이 없습니다. 그러나 JavaScript 라이브러리로서 React 프로젝트에 쉽게 통합할 수 있습니다.

Ease of Use: Code Examples

  • jsqr:

    QR 코드 스캔 예제

    import jsQR from 'jsqr';
    const imageData = ...; // 이미지 데이터 가져오기
    const code = jsQR(imageData.data, imageData.width, imageData.height);
    if (code) {
      console.log('QR 코드 데이터:', code.data);
    }
    
  • react-qr-code:

    React에서 QR 코드 생성 예제

    import { QRCode } from 'react-qr-code';
    const MyComponent = () => (
      <QRCode value="https://example.com" size={128} fgColor="#000" bgColor="#fff" />
    );
    
  • qr.js:

    클라이언트 측 QR 코드 생성 예제

    <div id="qrcode"></div>
    <script src="qr.js"></script>
    <script>
      const qrcode = new QRCode(document.getElementById('qrcode'), {
        text: 'https://example.com',
        width: 128,
        height: 128,
      });
    </script>
    
  • qr-image:

    서버 측 QR 코드 생성 예제

    const qr = require('qr-image');
    const fs = require('fs');
    const svg = qr.image('https://example.com', { type: 'svg' });
    svg.pipe(fs.createWriteStream('qr.svg'));
    
  • qrious:

    커스터마이징된 QR 코드 생성 예제

    const QRious = require('qrious');
    const qr = new QRious({
      element: document.getElementById('qrcode'),
      value: 'https://example.com',
      size: 200,
      background: 'white',
      foreground: 'blue',
    });
    

선택 방법: jsqr vs react-qr-code vs qr.js vs qr-image vs qrious

  • jsqr:

    QR 코드를 스캔해야 하는 경우 jsqr를 선택하세요. 이 라이브러리는 빠르고 정확한 QR 코드 디코딩 기능을 제공하며, 특히 카메라 피드에서 실시간으로 QR 코드를 읽는 데 적합합니다.

  • react-qr-code:

    React 애플리케이션에서 QR 코드를 생성해야 하는 경우 react-qr-code를 선택하세요. 이 라이브러리는 React 컴포넌트로 쉽게 통합할 수 있으며, QR 코드 생성에 필요한 다양한 속성을 제공합니다.

  • qr.js:

    클라이언트 측에서 간단한 QR 코드를 생성해야 하는 경우 qr.js를 선택하세요. 이 라이브러리는 사용하기 쉽고, 외부 종속성이 없으며, 빠르게 QR 코드를 생성할 수 있습니다.

  • qr-image:

    서버 측에서 QR 코드를 이미지 파일(PNG, SVG 등)로 생성해야 하는 경우 qr-image를 선택하세요. 이 라이브러리는 Node.js 환경에서 쉽게 통합할 수 있으며, 다양한 이미지 형식을 지원합니다.

  • qrious:

    QR 코드 생성에 더 많은 커스터마이징 옵션이 필요한 경우 qrious를 선택하세요. 이 라이브러리는 크기, 색상, 배경 등을 조절할 수 있는 기능을 제공하여 더 스타일리시한 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.