@cromwellian/granite-qrcode-decoder
v1.0.2
Published
an element to decode a QR Code from an image
Downloads
6
Readme
granite-qrcode-decoder
An element to decode a QR Code from an image. using a modified version of Lazersoft's jsqrcode library, to allow
jsqrcode
to deal with ShadowDOMPolymer 2.x element
Doc & demo
The element can decode several sources of images:
- A dataURL, by using the
dataUrl
property - An
app-media-image-capture
, by injecting it to theblob
property - A canvas, by calling the
decodeCanvas
method passing the canvas as parameter
https://lostinbrittany.github.io/granite-qrcode-decoder
Usage example
<granite-qrcode-decoder
last-decoded-data="{{data}}"
data-url="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAXIAAAFyAQMAAADS6sNKAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABn0lEQVR4nO2aS46EMAxELXEAjsTVcyQO0FJ6sF0xBBazmlGhqoW7SV6ywYk/3WaSJEmSJP2Peupjtu3H42GaLd1sxVwTz8vHw/qxAFpRPlaIeE5+zTl3ijDTmPg38Lb9fCkj/m28DeOLTPwreP9YM17DLL+4/8Uz8Cm/xSeDOfG8/GXlNWg/UuK5eAA9Uu2soo7z7jWW4dCLJ+Uj7dozcjtfE1FDN/G8/EmneA1HiWxNPDOPVMy8y+Vjno9ZGjPxzDxqp2Z+toHmRsuD/4jn4ROAF/RRTw1HEU/M+1w0uFwRpZGK4eSLZ+UvpxzHf8Tr2M3EE/Nr3ufoYjq/ZHn1cJ+LZ+LrjdfKdAUY8cR8NTCnUgqucPcf8UR8lVJxlfse2e86NN/n4rn4fOPV5fKVg282STwXf14ZrepLenbrd4nn4nGuP8MzvJTqHY3s+f4Xz8XHw+h3HaosTDw/f3n36ILAUVptKZ6bv/9LKwO5+FfwMbwhXlvk4A+/L4un4v0jvKAPqtCn/qd4Hj6FAO3Ltx2L7v0T8VS8JEmSJEl/qS/3CycsizQPTAAAAABJRU5ErkJggg=="
debug></granite-qrcode-decoder>
Decoded QR code: [[data]]
Install
Install the component using Bower:
$ bower install LostInBrittany/granite-qrcode-decoder --save
Or download as ZIP.## Usage
Import Web Components' polyfill (if needed):
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
Import Custom Element:
<link rel="import" href="bower_components/granite-qrcode-scanner/granite-qrcode-decoder.html">
Start using it!
<granite-qrcode-decoder> </granite-qrcode-decoder>
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D