Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Captcha  RSS feed

 
Luciano Queiroz
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks!
Have you ever seen anything about Captcha - completely automated public Turing test to tell computers and humans apart ?

Take a look at the link bellow:
http://en.wikipedia.org/wiki/Captcha

I would like to implement something like that using Java 2D.
Could anyone give any idea about?
Thanks in advance!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can generate images of text by using a BufferedImage... create a BufferedImage big enough for your text and then get the graphics context of the buffered image using getGraphics() or createGraphics(). use drawString() to paint the text onto your image.

You can make a subclass of BufferedImageOp to provide the distortion and run your image through it.

At this point you can pass your buffered image to an ImageIcon to put it up on a GUI, or you can use something like ImageIO to write an image file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!