Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 38: Adding node support #65

Merged
merged 13 commits into from
Sep 15, 2015
Merged

Issue 38: Adding node support #65

merged 13 commits into from
Sep 15, 2015

Conversation

serratus
Copy link
Owner

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.

serratus added a commit that referenced this pull request Sep 15, 2015
closes #38 by adding node support
@serratus serratus merged commit a852394 into master Sep 15, 2015
@serratus serratus deleted the issue-38 branch September 15, 2015 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant