kewarr

1.2.1 • Public • Published

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

  • Numbers: 0~9

  • Letters: a~z, A~Z

  • Common punctuations:

    · , . : ; + - * / \ ~ ! @ # $ % ^ & ` ' = < > [ ] ( ) ? _ { } | and  (space)

License

kewarr is licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i kewarr

Weekly Downloads

4

Version

1.2.1

License

MIT

Last publish

Collaborators

  • jakedchampion