kewarr
A way to generate qr-codes which can contain images and colour. Works in the browser, in NodeJS and as a CLI.
Table of Contents
Requirements
- Node.js
- npm (normally comes with Node.js)
Usage
CLI
kewarr https://example.com --picture example.jpg --colorized --name qr-example.png --directory ./
Node
const qr = require('kewarr')
qr(
'https://example.com',
'../images/purple-github.jpg',
'qr-example.png',
true,
'./'
).then(([qrName]) => {
console.log('Success! QR-code is saved at: ' + qrName)
})
browser
const qr = require('kewarr/src/lib/theqrmodule')
const combine = qr.combine
require('Jimp/browser/lib/jimp')
qr(
'https://example.com'
).then(([qr, ver]) =>
Jimp.read('./purple-github.jpg')
.then(picture =>
combine(picture, qr, true, ver)
)
.catch(e => qr)
)
.then(qr => {
qr
.getBase64(Jimp.AUTO, (err, src) => {
const img = document.createElement('img')
img.src = src
document.body.appendChild(img)
})
})
Tips
-
Use a square picture instead of a rectangle one.
-
If the size of the picture is large, you should also choose a large -v
/version
instead of using the default.
Supported Characters
License
kewarr is licensed under the MIT license.