Basically, pick a font and draw each character to an image. You can do different transformations to make the image harder to process by a computer. For example, you can make each letter a different font, a different color, a different size, a different rotation, or with different characteristics (underlining, strikethrough, embossing, etc.). You could create a mask from a different random image (of, say, a zebra) so that you are only drawing the image where the letter would have been drawn. You can pick a random backgound for the picture and create an equation that uses pseudo-random parameters to fluctuate the brightness of the image behind the letters. You can place dots of random size and shape on the image. Try to choose transformations that humans can recognize but that computers would have difficulty processing.
Then, save the random string with that image and use them in combination later to determine if the user entered the correct text. Serve up the image to the user, then compare their guess to the saved random string.