Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexeyten/qr-image
Yet another QR code generator
https://github.com/alexeyten/qr-image
javascript qr qrcode
Last synced: 2 days ago
JSON representation
Yet another QR code generator
- Host: GitHub
- URL: https://github.com/alexeyten/qr-image
- Owner: alexeyten
- License: mit
- Created: 2014-02-21T13:45:20.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-02-23T07:19:13.000Z (11 months ago)
- Last Synced: 2025-01-08T20:29:32.369Z (3 days ago)
- Topics: javascript, qr, qrcode
- Language: JavaScript
- Size: 107 KB
- Stars: 1,054
- Watchers: 31
- Forks: 168
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-canvas - qr-image - Yet another QR code generator. ![](https://img.shields.io/github/stars/alexeyten/qr-image?style=social) ![](https://img.shields.io/github/forks/alexeyten/qr-image?style=social) (Libraries / QR code)
- favorite-link - QR 码生成器。
- awesome-github-star - qr-image
- awesome-nodejs-pure-js - qr image
README
qr-image
========[![npm version](https://badge.fury.io/js/qr-image.svg)](https://badge.fury.io/js/qr-image)
This is yet another QR Code generator.
Overview
--------* No dependecies;
* generate image in `png`, `svg`, `eps` and `pdf` formats;
* numeric and alphanumeric modes;
* support UTF-8.[Releases](https://github.com/alexeyten/qr-image/releases/)
Installing
-----```shell
npm install qr-image
```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' });
```Example For generate images in client side:
```javascript in your app.js
var qr = require('qr-image');
router.get('/qr', function(){
var code = qr.image('http://www.google.com', { type: 'png' });
res.setHeader('Content-type', 'image/png'); //sent qr image to client side
code.pipe(res);
});
```
then in the html files:
```
```[More examples](./examples)
`qr = require('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 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.### 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`, `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.Changes
-------* Use `zlib.deflateSync` instead of `pako`.
* Fix deprecation warning for NodeJS 7.TODO
----* Tests;
* mixing modes;
* Kanji (???).