jsqr vs qr-code-styling vs html5-qrcode vs qrcode-reader vs qrious vs qr-scanner
JavaScript QR Code Libraries Comparison
1 Year
jsqrqr-code-stylinghtml5-qrcodeqrcode-readerqriousqr-scannerSimilar Packages:
What's JavaScript QR Code Libraries?

These libraries provide various functionalities for generating and scanning QR codes in web applications. They cater to different needs, such as styling, scanning capabilities, and ease of integration, making it easier for developers to implement QR code features in their projects. Each library has unique strengths, from simple scanning to customizable QR code generation, allowing developers to choose based on their specific requirements.

NPM Package Downloads Trend
Github Stars Ranking
Stat Detail
Package
Downloads
Stars
Size
Issues
Publish
License
jsqr297,7573,771-964 years agoApache-2.0
qr-code-styling195,2461,622515 kB692 days agoMIT
html5-qrcode99,4655,2052.63 MB3762 years agoApache-2.0
qrcode-reader64,573278-177 years agoApache-2.0
qrious53,3461,556-428 years agoGPL-3.0
qr-scanner51,2302,565524 kB113-MIT
Feature Comparison: jsqr vs qr-code-styling vs html5-qrcode vs qrcode-reader vs qrious vs qr-scanner

Scanning Capability

  • jsqr:

    jsqr is optimized for fast scanning and can decode QR codes from video streams efficiently, making it suitable for high-performance applications.

  • qr-code-styling:

    qr-code-styling does not provide scanning capabilities; its focus is solely on generating styled QR codes.

  • html5-qrcode:

    html5-qrcode offers real-time scanning using the device camera and can also read QR codes from image files, providing flexibility for various use cases.

  • qrcode-reader:

    qrcode-reader is designed to read QR codes from static images, making it ideal for applications that process uploaded images rather than live feeds.

  • qrious:

    qrious does not support scanning; it is focused on generating QR codes quickly and easily.

  • qr-scanner:

    qr-scanner provides a simple interface for scanning QR codes using the camera, with a focus on ease of use and quick integration.

Customization Options

  • jsqr:

    jsqr is primarily focused on performance and does not provide customization options for the scanning interface.

  • qr-code-styling:

    qr-code-styling excels in customization, allowing developers to change colors, shapes, and add logos to QR codes, making it great for branding.

  • html5-qrcode:

    html5-qrcode offers limited customization options for the scanning interface, focusing more on functionality than aesthetics.

  • qrcode-reader:

    qrcode-reader does not offer customization options, as its primary function is to read QR codes from images.

  • qrious:

    qrious allows for basic customization of QR code size and error correction level, but it is not as extensive as qr-code-styling.

  • qr-scanner:

    qr-scanner provides basic customization options for the scanning interface, allowing developers to adjust the appearance to some extent.

Ease of Use

  • jsqr:

    jsqr has a simple API that is easy to integrate, but may require more setup for optimal performance in real-time applications.

  • qr-code-styling:

    qr-code-styling is designed for ease of use, with clear documentation and examples for creating styled QR codes without hassle.

  • html5-qrcode:

    html5-qrcode is user-friendly with straightforward documentation, making it easy for developers to implement scanning features quickly.

  • qrcode-reader:

    qrcode-reader is simple to use for reading QR codes from images, with clear instructions for integration.

  • qrious:

    qrious is straightforward to use, allowing developers to generate QR codes with just a few lines of code.

  • qr-scanner:

    qr-scanner is very easy to use, with minimal configuration needed to get started, making it ideal for quick projects.

Performance

  • jsqr:

    jsqr is highly optimized for performance, providing fast decoding even in challenging conditions, making it suitable for real-time applications.

  • qr-code-styling:

    qr-code-styling focuses on generating visually appealing QR codes, but performance may vary based on the complexity of the design.

  • html5-qrcode:

    html5-qrcode performs well in most scenarios, but may experience latency in low-light conditions or with low-quality cameras.

  • qrcode-reader:

    qrcode-reader's performance is dependent on the quality of the images being processed; it works best with clear, high-resolution images.

  • qrious:

    qrious generates QR codes quickly, but does not focus on scanning performance.

  • qr-scanner:

    qr-scanner is designed for quick scanning, but performance can be affected by the device's camera quality and lighting conditions.

Community and Support

  • jsqr:

    jsqr has a smaller community but is well-documented, providing sufficient support for developers.

  • qr-code-styling:

    qr-code-styling has a vibrant community, with many resources and examples available for developers looking to create styled QR codes.

  • html5-qrcode:

    html5-qrcode has a growing community and decent support, with active development and updates.

  • qrcode-reader:

    qrcode-reader has limited community support, but the documentation is clear for basic usage.

  • qrious:

    qrious has a small community, but offers straightforward documentation for generating QR codes.

  • qr-scanner:

    qr-scanner has a modest community and provides basic support through documentation and GitHub issues.

How to Choose: jsqr vs qr-code-styling vs html5-qrcode vs qrcode-reader vs qrious vs qr-scanner
  • jsqr:

    Select jsqr if you require a lightweight and fast QR code scanning library that focuses on performance and accuracy. It is ideal for applications where speed is crucial, such as real-time scanning.

  • qr-code-styling:

    Opt for qr-code-styling if you want to create visually appealing QR codes with customizable styles, colors, and logos. This library is perfect for marketing materials where aesthetics matter.

  • html5-qrcode:

    Choose html5-qrcode if you need a straightforward and efficient QR code scanning solution that works well in web browsers. It supports both camera and file input, making it versatile for various applications.

  • qrcode-reader:

    Choose qrcode-reader if you need a robust solution for reading QR codes from images. This library is suitable for applications that require processing static images rather than live camera feeds.

  • qrious:

    Select qrious if you want a straightforward library for generating QR codes with minimal configuration. It is particularly useful for projects that need quick and easy QR code generation without complex features.

  • qr-scanner:

    Use qr-scanner for a simple and effective QR code scanning experience with minimal setup. It is designed for quick integration into projects and works well across different devices.

README for jsqr

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.