Skip to content

v0.7.0

Compare
Choose a tag to compare
@serratus serratus released this 15 Sep 18:07
· 149 commits to master since this release

Node Support

Basic node support has landed in QuaggaJS, finally allowing to decode images on the server-side as well. Due to the lack of the DOM and navigator, <video/> and getUserMedia are not supported for now. Maybe, in the distant future, this will be abstracted for the use with plugins, if needed. For now, this means only decodeSingle is available to the node environment.

How do I use it in node?

The following example illustrates the basic use within node:

var Quagga = require('quagga');

Quagga.decodeSingle({
    src: "image-abc-123.jpg",
    numOfWorkers: 0,  // Needs to be 0 when used within node
    inputStream: {
        size: 800  // restrict input-size to be 800px in width (long-side)
    },
    decoder: {
        readers: ["code_128_reader"] // List of active readers
    },
}, function(result) {
    if(result.codeResult) {
        console.log("result", result.codeResult.code);
    } else {
        console.log("not detected");
    }
});

Under the hood

The combination of ndarray and get-pixels provides a simple and intuitive way to replace the <image/>, <canvas/> and CanvasContext pipeline for reading/pre-processing images within node.

Dependencies

In addition to the two packages mentioned above, the new release also switches from the statically included libraries such as requirejs and glMatrix to npm dependencies.