annotate pycaptcha/simple_example.py~ @ 87:4775b4195b4b

code pour la generation de captchas
author goldfinger
date Thu, 11 Feb 2010 05:09:46 -0500
parents
children
rev   line source
87
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
1 #!/usr/bin/env python
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
2 #
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
3 # A very simple example that creates a random image from the
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
4 # PseudoGimpy CAPTCHA, saves and shows it, and prints the list
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
5 # of solutions. Normally you would call testSolutions rather
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
6 # than reading this list yourself.
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
7 #
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
8 from Captcha.Visual.Tests import PseudoGimpy, AngryGimpy
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
9 import numpy
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
10 #from numpy import *
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
11
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
12 g = AngryGimpy()
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
13 i = g.render()
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
14 a = numpy.asarray(i)
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
15 b = numpy.zeros((2, 2), numpy.int8)
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
16 c = a == b
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
17 print c
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
18 i.save("output.png")
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
19 i.show()
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
20 #print a
4775b4195b4b code pour la generation de captchas
goldfinger
parents:
diff changeset
21 #print g.solutions