The images produced by these open source packages looks good enough. Both are very easy to setup.
// build captcha
Captcha captcha = Captcha.Builder(200, 50)
.addText()
.gimp()
.addBorder()
.addBackground(new GradiatedBackgroundProducer())
.build();
// write image
ImageIO.write(captcha.getImage(), "png", output);
// 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);
0 comments:
Post a Comment