Skip to content

Commit

Permalink
Version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyten committed Aug 22, 2014
1 parent ab3a5e0 commit b7843f3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
qr-image
=========
========

This is yet another QR Code generator.

Expand All @@ -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 (???).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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" ],
Expand Down

0 comments on commit b7843f3

Please sign in to comment.