UNPKG

captcha-generator

Version:

Production image verification code by jpeglib

28 lines (24 loc) 809 B
## Install ``` $ npm install --save captcha-generator ``` # Overview This is a captcha generator that can only generate image verification code because I do not like [ccap](https://github.com/DoubleSpout/ccap), ccap uses not only trouble but also low performance and easy memory leak. captcha-generator can also be used across platforms. ![preview](https://apk.kktv8.com/share/other/cg.bmp) # Usage `import {generate, createPlaintext} from "captcha-generator" ` # Get the verification code by default ``` const cimg = generate(); const {base64, plaintext, buffer, imageType} = cimg; ``` # Customize picture content and width and height ``` const cimg = generate({ text: createPlaintext(6), width: 500, height: 200, fontSize: 200 } ); const {base64, plaintext, buffer, imageType} = cimg; ```