Python OCR error OCRExitcode - 99

I am trying to read text from images using the free API.
I was able to get decoded values earlier today, but no wit is giving me this response -

{‘OCRExitCode’: 99, ‘IsErroredOnProcessing’: True, ‘ErrorMessage’: [‘Unable to recognize the file type’], ‘ProcessingTimeInMilliseconds’: ‘0’}

I have generated my free API key and using it.
When I try to decode the same image on an android app, which is on a different system, it gets decoded correctly.

I did this using multiple images on my system, but it shows the same error every time.
What could be the possible cause of such behaviour?

P.S - On the android app as well, I could see the same error at times, but it vanishes by itself!!

If you test the connection with Postman, do you get the same result?

You probably know it, but just in case: Postman is a free Chrome app, see

If you see the problem even with Postman, a screenshot of the result could be helpful.

NO, With postman it is not giving any error.

If it works with Postman, then there is something wrong with your API call inside the app. Postman has a feature to export code snippets for API calls. Can you try the code it exported there? Or you can post your code here, maybe we can see what is wrong.

The following code didn’t work for me :

img = cv2.imread(filename)

height, width, _ = img.shape

roi = img


url_api = “
_, compressedimage = cv2.imencode(".jpg", roi, [1, 90])
file_bytes = io.BytesIO(compressedimage)

result =,
files={“filename” : img},
data = {“apikey”: “800a5ff0cc88957”,
“language”: “eng”,
“isTable” : “True”})

result = result.content.decode()
result = json.loads(result)

It worked after I changed my encoding from this -

_, compressedimage = cv2.imencode(".jpg", roi, [1, 90])

file_bytes = io.BytesIO(compressedimage)

TO this -

with open(filename, ‘rb’) as f:

Thanks for posting the solution! :smiley: