SimpleCaptcha and Kaptcha
Tuesday, August 9, 2011
The images produced by these open source packages looks good enough. Both are very easy to setup.
SimpleCaptcha (http://simplecaptcha.sourceforge.net)
// build captcha
Captcha captcha = Captcha.Builder(200, 50)
.addText()
.gimp()
.addBorder()
.addBackground(new GradiatedBackgroundProducer())
.build();
// write image
ImageIO.write(captcha.getImage(), "png", output);
Kaptcha (http://code.google.com/p/kaptcha)
// configurations
Properties prop = new Properties();
prop.setProperty(Constants.KAPTCHA_NOISE_IMPL,
"com.google.code.kaptcha.impl.NoNoise");
prop.setProperty(Constants.KAPTCHA_OBSCURIFICATOR_IMPL,
"com.google.code.kaptcha.impl.WaterRipple");
// build captcha
Config config = new Config(prop);
Producer producer = config.getProducerImpl();
String text = producer.createText();
// write image
ImageIO.write(producer.createImage(text), "png", output);
Labels:
captcha

