| 8 | |
| 9 | |
| 10 | def main(): |
| 11 | guido_img = Image.open(open('guido.jpg', 'rb')) |
| 12 | guido2_img = guido_img.filter(ImageFilter.GaussianBlur) |
| 13 | guido2_img.save(open('guido2.jpg', 'wb')) |
| 14 | |
| 15 | img1 = Image.open(open('tesseract.png', 'rb')) |
| 16 | img2 = img1.point(lambda x: 0 if x < 128 else 255) |
| 17 | img2.save(open('tesseract2.png', 'wb')) |
| 18 | |
| 19 | print(image_to_string(img2)) |
| 20 | |
| 21 | resp = requests.get('https://pin2.aliyun.com/get_img?type=150_40&identity=mailsso.mxhichina.com&sessionid=k0xHyBxU3K3dGXb59mP9cdeTXxL9gLHSTKhRZCryHxpOoyk4lAVuJhgw==') |
| 22 | img3 = Image.open(BytesIO(resp.content)) |
| 23 | img3.save('captcha.jpg') |
| 24 | print(image_to_string(img3)) |
| 25 | print(base64.b64encode(resp.content)) |
| 26 | |
| 27 | |
| 28 | if __name__ == '__main__': |