From b7843f33b6dc43d82cdc614d2b846e1480c74f57 Mon Sep 17 00:00:00 2001 From: "Alexey Ten (Lynn)" Date: Fri, 22 Aug 2014 14:01:24 +0400 Subject: [PATCH] Version 2.0 --- README.md | 28 +++++++++++++++++++++------- package.json | 2 +- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1c7ecec..d4c5843 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ qr-image -========= +======== This is yet another QR Code generator. @@ -17,35 +17,49 @@ Usage ----- Example: -``` +```javascript var qr = require('qr-image'); var qr_svg = qr.image('I love QR!', { type: 'svg' }); qr_svg.pipe(require('fs').createWriteStream('i_love_qr.svg')); + +var svg_string = qr.imageSync('I love QR!', { type: 'svg' }); ``` [More examples](./examples) `qr = require('qr-image')` -`qr.image(text, [ec_level | options])` — returns Readable stream with image data. -`qr.matrix(text, [ec_level])` — returns 2D array. +### Methods + + * `qr.image(text, [ec_level | options])` — Readable stream with image data; + * `qr.imageSync(text, [ec_level | options])` — string with image data. (not implemented for `png`); + * `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 of `L`, `M`, `Q`, `H`. Default `M`. * `options` — image options object: * `ec_level` — default `M`. - * `type` — image type. Possible values `png` (default), `svg` (`svgpath`), `pdf` and `eps`. + * `type` — image type. Possible values `png` (default), `svg`, `pdf` and `eps`. * `size` (only png) — size of one module in pixels. Default `5`. - * `margin` (only png) — white space around QR image in modules. Default `4`. + * `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. -`svgpath` is not really an image, but content of `d` attribute of corresponding SVG image. +Changes +------- + + * `svgpath` type is deprecated. Use `svgObject` method instead. + * `margin` option is used for vector formats. TODO ---- * Tests; + * `imageSync` for `png`. * mixing modes; * Kanji (???). diff --git a/package.json b/package.json index f55f9ed..4c743fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "qr-image", - "version": "1.2.1", + "version": "2.0.0", "description": "QR Code generator (png, svg, pdf, eps)", "homepage": "https://github.com/alexeyten/qr-image", "keywords": [ "qrcode", "qr code", "qr", "png", "svg", "image" ],