node-qr-image
alexeyten/qr-image
THIS REPO IS BESED ONDIFFERENCES:
- change
size
option to image'swidth
||height
. - remove
margin
option.
This is yet another QR Code generator.
Overview
- No dependecies;
- generate image in
png
,svg
,eps
andpdf
formats; - numeric and alphanumeric modes;
- support UTF-8.
Installing
npm install node-qr-image
Usage
Example:
var qr = ; var qr_svg = qr;qr_svg; var svg_string = qr;
qr = require('node-qr-image')
Methods
qr.image(text, [ec_level | options])
— Readable stream with image data;qr.imageSync(text, [ec_level | options])
— string with image data. (Buffer forpng
);qr.svgObject(text, [ec_level | options])
— object with SVG path and size;qr.matrix(text, [ec_level])
— 2D array.
Options
text
— text to encode;ec_level
— error correction level. One ofL
,M
,Q
,H
. DefaultM
.options
— image options object:ec_level
— defaultM
.type
— image type. Possible valuespng
(default),svg
,pdf
andeps
.size
(png and svg only) — size of IMAGE's width or height in pixels. Default100
for png andundefined
for svg.margin
— white space around QR image in modules. Default4
forpng
and1
for others.customize
(only png) — function to customize qr bitmap before encoding to PNG.parse_url
(experimental, defaultfalse
) — try to optimize QR-code for URLs.
Changes
- Implement
imageSync
forpng
.
TODO
- Tests;
- mixing modes;
- Kanji (???).