# qr-image

> QR Code generator (png, svg, pdf, eps)

Latest version **3.2.0** (published 2016-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install qr-image
pnpm add qr-image
yarn add qr-image
bun add qr-image
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.0 |
| Published | 2016-12-22 |
| First published | 2014-02-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/qr-image) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1064 |
| Author | Alexey Ten |
| Maintainers | alexeyten |
| Keywords | qrcode, qr code, qr, png, svg, image |

## Links

- npm: https://www.npmjs.com/package/qr-image
- Repository: https://github.com/alexeyten/qr-image
- Issues: https://github.com/alexeyten/qr-image/issues
- npm.io page: https://npm.io/package/qr-image

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 3.2.0 (latest) — 2016-12-22
- 3.1.0 — 2015-01-24
- 3.0.2 — 2014-12-30
- 3.0.1 — 2014-12-29
- 3.0.0 — 2014-12-15
- 2.0.0 — 2014-08-22
- 1.2.1 — 2014-07-31
- 1.2.0 — 2014-06-25
- 1.1.0 — 2014-03-05
- 1.0.1 — 2014-03-03
- 1.0.0 — 2014-02-21

## 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' });
```

[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.


### 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 (???).

---
_Source: https://npm.io/package/qr-image · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
