Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript library for QR image decoder

Tags:

javascript

I browse through few sites but did not find a code snippet to decode a QR code image in javascript. I gone through qrCode.js but all it has is QR code generator . I am looking for a qr code decoder which can decode a base64 QR image and get me the details.

like image 657
Siva A Avatar asked May 30 '12 05:05

Siva A


1 Answers

There is a JavaScript port of a Java library for reading qr codes: Web QR
The code can be found on GitHub

From the readme:

Usage:

Include the scripts in the following order:

<script type="text/javascript" src="grid.js"></script>
<script type="text/javascript" src="version.js"></script>
<script type="text/javascript" src="detector.js"></script>
<script type="text/javascript" src="formatinf.js"></script>
<script type="text/javascript" src="errorlevel.js"></script>
<script type="text/javascript" src="bitmat.js"></script>
<script type="text/javascript" src="datablock.js"></script>
<script type="text/javascript" src="bmparser.js"></script>
<script type="text/javascript" src="datamask.js"></script>
<script type="text/javascript" src="rsdecoder.js"></script>
<script type="text/javascript" src="gf256poly.js"></script>
<script type="text/javascript" src="gf256.js"></script>
<script type="text/javascript" src="decoder.js"></script>
<script type="text/javascript" src="qrcode.js"></script>
<script type="text/javascript" src="findpat.js"></script>
<script type="text/javascript" src="alignpat.js"></script>
<script type="text/javascript" src="databr.js"></script>

To get the decoded information set:

qrcode.callback = function(decodedData) {
    //...
}

Decode image with:

qrcode.decode(url or DataURL)

Decode from canvas with "qr-canvas" ID:

qrcode.decode()

An example can be also found in the repo.

like image 112
Andreas Avatar answered Oct 13 '22 19:10

Andreas