gm-captcha

1.0.2 • Public • Published

gm-captchaBuild Statusnpm

a node captcha library using the gm module

gm is the GraphicsMagick and ImageMagick for node

gm document

Getting started

First download and install GraphicsMagick or ImageMagick. In Mac OS X, you can simply use Homebrew and do:

brew install imagemagick
brew install graphicsmagick

then either use npm:

npm install gm-captcha

Usage

var gmCaptcha = require('gm-captcha');
var options = {
    width: 100,
    height: 50,
    text: '1024'
}
// Other configurations using default parameters
var captcha  = new gmCaptcha();
var gmObj = captcha.generator(); // return a gm object
captcha.gmBuffer(gmObj, 'PNG', function (buffer) {
    // do something with buffer
});

Options

fileddescriptiondefault
widthimage width100
heightimage height50
backgroundimage background, support rgb or hex#fff
colorCountthe maximum color count of the point and line displayed20
textthe text you want to displayRandom four digit
maxTextWidththe max font weight you want to display3
textColorCountthe max color count of the text displayed20
textColortext color, support rgb or hexrandom color between 0 and 20
textIndentindent, left margin of text0
wordSpacingword space25
maxSwirlthe maximum degree of the picture center swirl20
maxShearthe maximum degree of the picture shear30
lineCountthe maximum count of line20
lineWidththe width of line1
pointCountthe maximum count of point500
fontfont pathDroidSansFallback
fontSizefont size50

License

MIT License

Copyright (c) [2016] [eidonjoe]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Package Sidebar

Install

npm i gm-captcha

Weekly Downloads

3

Version

1.0.2

License

MIT

Last publish

Collaborators

  • eidonjoe