Skip to content


Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

QR Code generator for node

Another QR code library for nodejs, aiming at allowing more customization on your QR code result :

  • changing background
  • changing code color (still needs some work)

This library is based on the native Cairo and libqrencode library, so as requirements you should have this two libraries installed on your OS :


Use npm.

npm install qr-cairo


The code below shows a basic example of generating an image with gr-cairo with default settings : transparent background, black foreground and correction level to "low".

var qr_cairo = require('qr-cairo');

// Qr without options'', 'test1.png');

Advanced Usage

Currently qr-cairo has one method that generates the qr image, path [, options])

value is the message that you want to encode as Qr code

path the path where you want to save the generated image

option JSON object that can contain the following parameters

option.back_color the background color in hexadecimal format (default color is transparent)

option.fill_color foreground color (default : #000000)

option.ec_level error correction level ('L' : LOW, 'M' : MEDIUM, 'Q' : QUALITY, 'H', HIGH)

option.box_size the box size in pixel of the qrcode

var qr_cairo = require('qr-cairo');

// Qr with options 
var options = {'ec_level': 'l', 'box_size': '20', 'back_color': '#ee4444', 'fill_color': '#222200'};"Amine", "test2.png", options);