0.0.4 • Published 5 months ago

jsqrgb v0.0.4

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 months ago

jsQRGB

Introduction

A javascript package for generating and recognizing QRGB codes.

QRGB code is an extension of the traditional QR code. It distributes data across three color channels (Red, Green, and Blue) to achieve the goal of storing more information within the same number of pixels compared to a standard QR code.

A demo of QRGB code:

demo

Warning

  • The QRGB code generated by the jsQRGB package is not compatible with traditional QR codes.

Installation

Install using npm:

npm install jsqrgb

Usage

import jsQRGB from "jsqrgb";

async function main() {
    // Recognize QRGB code
    const canvas = document.createElement('canvas')
    const ctx = canvas.getContext('2d')!;
    const imgData = ctx.getImageData(0, 0, frame.displayWidth, frame.displayHeight)
    const data = jsQRGB.recognize(imgData);
    // async
    const data = await jsQRGB.recognizeAsync(imgData);

    // Generate QRGB code
    const data = 'Hello World';
    const qrgbImageData = jsQRGB.generate(textEncoder.encode(data), {
        size: canvasSize,
    });
    // async
    const qrgbImageData = await jsQRGB.generateAsync(textEncoder.encode(data), {
        size: canvasSize,
    });
}
0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago