zxing-js / library

Multi-format 1D/2D barcode image processing library, usable in JavaScript ecosystem.
https://zxing-js.github.io/library/
Apache License 2.0
2.48k stars 547 forks source link

How to pass an array containing a 1D barcode and have it be decoded? #390

Open tucson-tom opened 3 years ago

tucson-tom commented 3 years ago

All of the examples use either img tags or a live video feed. However, I already have a set of bits that have a 95% probability of representing a 1D barcode in a Javascript array in a known format (e.g. ITF). I'd like to pass the array directly instead of creating a hidden canvas element, drawing on the canvas, exporting a PNG from the canvas, and then passing the PNG to ZXing to basically have it do the complete reverse of that process. That seems like a lot of unnecessary overhead to me.

If it is not currently possible to pass an array, then this is a feature request to add the ability to directly pass an array of information to be decoded in a known format.

However, if it is possible to just pass an array, it would be nice if it were officially documented somewhere (e.g. the examples).

tucson-tom commented 3 years ago

I no longer need this since I ended up implementing my own barcode parser/reader for my specific barcode (weighing in at a grand total of 24KB of unminified Javascript). But I'll leave this issue open since someone may want to do this with ZXing.