Awesome Open Source
Awesome Open Source


npm version

This is yet another QR Code generator.


  • No dependecies;
  • generate image in png, svg, eps and pdf formats;
  • numeric and alphanumeric modes;
  • support UTF-8.



npm install qr-image



var qr = require('qr-image');

var qr_svg = qr.image('I love QR!', { type: 'svg' });

var svg_string = qr.imageSync('I love QR!', { type: 'svg' });

Example For generate images in client side:

var qr = require('qr-image');
router.get('/qr', function(){
  var code = qr.image('', { type: 'png' });
  res.setHeader('Content-type', 'image/png');  //sent qr image to client side

then in the html files:

<img src="/qr" alt="qrcode">

More examples

qr = require('qr-image')


  • qr.image(text, [ec_level | options]) — Readable stream with image data;
  • qr.imageSync(text, [ec_level | options]) — string with image data. (Buffer for png);
  • qr.svgObject(text, [ec_level | options]) — object with SVG path and size;
  • qr.matrix(text, [ec_level]) — 2D array of booleans. Y is indexed first (e.g. [y][x] NOT [x][y]), [0][0] is the top left, and true means black.


  • text — text to encode;
  • ec_level — error correction level. One of L, M, Q, H. Default M.
  • options — image options object:
    • ec_level — default M.
    • type — image type. Possible values png (default), svg, pdf and eps.
    • size (png and svg only) — size of one module in pixels. Default 5 for png and undefined for svg.
    • margin — white space around QR image in modules. Default 4 for png and 1 for others.
    • customize (only png) — function to customize qr bitmap before encoding to PNG.
    • parse_url (experimental, default false) — try to optimize QR-code for URLs.


  • Use zlib.deflateSync instead of pako.
  • Fix deprecation warning for NodeJS 7.


  • Tests;
  • mixing modes;
  • Kanji (???).

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Javascript (1,155,559
Qrcode (5,812
Qr Code (5,797
Svg Path (149