Jcaptcha image
Hi,
I am trying to change the background color of the image. But it is working sometimes, remaining times getting defult image with funky background color.
Does anyone face this problem and how to fix this?
Thanks in advance.
rajk
Code:
public static ImageCaptchaService makeImage(){
SimpleListImageCaptchaEngine engine = new SimpleListImageCaptchaEngine();
UniColorBackgroundGenerator bgGen = new UniColorBackgroundGenerator(new Integer(200), new Integer(100), Color.WHITE);
RandomTextPaster txtPstr = new RandomTextPaster(new Integer(5), new Integer(5), Color.BLACK);
System.out.println("engine..." + engine.addFactory(new GimpyFactory(new RandomWordGenerator("0123456789"),
new ComposedWordToImage(new RandomFontGenerator(new Integer(16), new Integer(20)),
bgGen, txtPstr))));
System.out.println("ImageCaptchaService....makeIma ge..." );
return new DefaultManageableImageCaptchaService(new FastHashMapCaptchaStore(), engine, 180, 100000, 75000);
}
|