Awesome
Update
This code base is no longer being developed. I have started this project with intent to allow Firefox OS apps developers add barcode/qrcode scanning capability to their apps, as well build simple barcode/qrcode scanner. Since Mozilla withdrawal from Firefox OS project I see much less interest in this library.
If anyone would like to continue porting feel free to fork the project. Let me know about the fork. I'm happy to link to it from README file.
zxingjs
JavaScript port of popular zxing library. Work in progress. Plan:
- Reading popular barcodes (DONE)
- Reading QR codes (in progress)
- Documentation, examples and tests for points
- Reading RSS
- Reading Data Matrix
- Generating barcodes
- Generating QR codes
- Generating RSS codes
- Generating Data Matrix codes
- More documentation, examples and tests
- Clean-up and optimizations (mostly speed, as well refactoring code to be a bit more JS friendly, supporting more environments)
Dependencies:
Quick and dirty example
require([
'zxing/oned/MultiFormatOneDReader',
'zxing/BinaryBitmap',
'zxing/RGBLuminanceSource',
'zxing/common/GlobalHistogramBinarizer'
], function (MultiFormatOneDReader, BinaryBitmap, RGBLuminanceSource, GlobalHistogramBinarizer) {
try {
var canvas = document.getElementById('canvas');
var image = canvas.getContext('2d').getImageData(0, 0, canvas.width, canvas.height);
var reader = new MultiFormatOneDReader();
var bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(new RGBLuminanceSource(canvas.width, canvas.height, image.data)));
var result = reader.decode(bitmap, {});
} catch (e) {
}
});
For more details please wait for documentation and examples, or refer to source code and original zxing library. This JavaScript port tries to stay as close to original as possible.