# captchapng2

> A numeric captcha generator for Node.js

Latest version **1.0.3** (published 2017-08-16) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install captchapng2
pnpm add captchapng2
yarn add captchapng2
bun add captchapng2
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2017-08-16 |
| First published | 2017-07-27 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Lellansin |
| Maintainers | lellansin |
| Keywords | captchapng |

## Links

- npm: https://www.npmjs.com/package/captchapng2
- Repository: https://github.com/Lellansin/captchapng
- Homepage: https://github.com/Lellansin/captchapng#readme
- Issues: https://github.com/Lellansin/captchapng/issues
- npm.io page: https://npm.io/package/captchapng2

## Dependencies (1)

- [node-pnglib](https://npm.io/package/node-pnglib.md) ^1.5.2

## Recent versions

- 1.0.3 (latest) — 2017-08-16
- 1.0.2 — 2017-07-27
- 1.0.1 — 2017-07-27
- 1.0.0 — 2017-07-27
- 0.0.1 — 2017-07-27

## README

# Lite PNG captcha generator

More faster and colorful version of [`captchapng`](https://www.npmjs.com/package/captchapng). (2~3 faster than orginal)

## Installation

```shell
npm install captchapng2
```

## Examples

```javascript
const http = require('http');
const captchapng = require('captchapng2');

http.createServer(function (req, res) {
  if(req.url == '/captcha.png') {
    let rand = parseInt(Math.random() * 9000 + 1000);
    let png = new captchapng(80, 30, rand); // width,height, numeric captcha

    res.writeHead(200, { 'Content-Type': 'image/png'});
    res.end(png.getBuffer());
  } else {
    res.end('');
  }
}).listen(8181);

console.log('Web server started.\nSee http:\\\\127.0.0.1:8181\\captcha.png');
```

output:

![captcha](examples/captcha.png)

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