为什么不能打开图片? [英] why can not open image?

查看:62
本文介绍了为什么不能打开图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

from PIL import Image
from operator import itemgetter
import os, hashlib, time, sys, subprocess, platform

class CIntruderOCR(object):
    """
    Class to apply OCR techniques into captchas
    """
    def __init__(self, captcha):
        # initialize main CIntruder
        try:
            im = Image.open(captcha)
            im2 = Image.new("P", im.size, 255)
            im = im.convert("P")
           
            im.show()
        except:
            print "Error during OCR process!. is that captcha supported?\n"
            return

if __name__ == "__main__":
    if sys.argv[1:]:
        ocr = CIntruderOCR(sys.argv[1:])
        print ("Data correctly extracted!")
    else:
        print ("You must set a captcha to learn. ex: test.gif")

推荐答案

这篇关于为什么不能打开图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆