I would like to disort some images the same way standard CAPTCHA disorts fonts. How would I achieve it in python? What libraries/algorithms I should use? Any proof-of-concept?
DISCLAIMER: I was googling for some time before I asked this question but I couldn't find any satisfying answer. I'm new to the field so I can't provide any code proving my 'research effort'...
I think you are looking for PyCaptcha http://svn.navi.cx/misc/trunk/pycaptcha/
The actual code to distort is here: http://svn.navi.cx/misc/trunk/pycaptcha/Captcha/Visual/Distortions.py
The work is done by PIL's transform function, like this:
image.transform(image.size, Image.MESH, mesh, self.filtering)
The rest of the code is there essentially to generate the mesh that is used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With