Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def recognize(img, lang, *, hints=None):
if hints == None:
hints = []
if OcrHint.SINGLE_LINE in hints:
img = ImageOps.expand(img, 32, fill=img.getpixel((0, 0)))
lang = Language(lang)
assert (OcrEngine.is_language_supported(lang))
eng = OcrEngine.try_create_from_language(lang)
swbmp = _swbmp_from_pil_image(img)
return _dump_ocrresult(_blocking_wait(eng.recognize_async(swbmp)))