#Crack reCAPTCHA
Dependencies
pip install pillow
brew install libpng
brew install libjpeg
pip install PIL --allow-external PIL --allow-unverified PIL
After that, let's try with an example
from PIL import Image
im = Image.open('image.jpeg') # jpeg or png
im = im.convert('L')
- Clean Noise.
def clean(im):
im = im.convert('L')
im = im.point(lambda x:255 if x>128 or x==0 else x)
im = im.point(lambda x:0 if x<255 else 255)
return im
- Splits into char images
#Divide by Columns
w, h = im.size
data = im.load()
jcolors = [sum(255-data[i,j] for j in range(h)) for i in range(w)]
print jcolors
- decode char images into chars
def im2array(im):
return [ int(x!='\xff') for x in im.tobytes() ]
Decoder JPEG not available error
Can't install PIL after Mac OS X 10.9
Python Image Library fails with message “decoder JPEG not available PIL”
decoding-weibo-captcha-in-python slides recommended