captcha-node
v1.0.3
Published
captcha generator
Downloads
15
Readme
captcha-node
create captcha with ImageMagick or GraphicsMagick
demo
prepare
- install ImageMagick
brew install imagemagick
or if you want to use GraphicsMagick
brew install graphicsmagick
Installation for other systems: ImageMagick, GraphicsMagick
- install package
npm install captcha-node
sample code
callback
var captcha = require('captcha-node')
var fs = require('fs')
var target = __dirname + '/gen.png';
captcha.genCaptcha({},function(err,data){
if(err){
console.trace(err.stack);
return
}
fs.writeFileSync(target,data.data);
});
co
co(function* (){
return yield captcha.genCaptcha({})
}).then((data) => {
fs.writeFileSync(target,data.data);
}).catch(console.error.bind(console));
option
- width
- height
- fontsize
- skech
- fontWidth
- bgcolor
- scolor
- fcolor
- text
- font_path
- engine -
ImageMagick
by default. Set asGraphicsMagick
if you use it.