Error: Bad image data

1,146 views
Skip to first unread message

Eugenio Roverato

unread,
Jan 11, 2022, 6:02:06 PM1/11/22
to cloud-vision-discuss
Good morning, I am trying to solve an issue that prevents me from using this API. The error in question occurs when I try to identify text from a PNG image (I've tried at both minimum and recommended resolutions). I got the code from the Google Vision documentation and was looking for help on StackOverflow, but I think it's a little known problem. I'll leave the link to explain it better.

Please help me figure out what I did wrong.

Shameem (Google Cloud Platform)

unread,
Jan 12, 2022, 5:05:01 PM1/12/22
to cloud-vision-discuss
I saw your Stackoverflow post [1]. Have you checked with the .jpg image format also?

Eugenio Roverato

unread,
Jan 12, 2022, 7:05:10 PM1/12/22
to cloud-vision-discuss
Yes, I have tried PNG, JPEG and JPG.
Today, while testing, I realised something that I had missed before: the program works and the ocr does not give any error but only if the image taken locally is already present in its directory.
The problem is that the OCR is inserted in a wider context and the image is created at runtime. In this case, it is not the image that cannot be read (because if you stop the program and read the image again, the program will work properly), but somewhere else.
The fact is that with this same script that creates the images I tested Tess4J and it worked (even if it had big defects as OCR).

Perhaps I need to insert some delay after the image has been created, even though the aim of this project was to speed up slow operations.

Are there precedents for this type of problem? Thanks

Shameem (Google Cloud Platform)

unread,
Jan 26, 2022, 7:58:00 PM1/26/22
to cloud-vision-discuss
Please note that Google Groups is reserved for general product discussions. If you still need further technical support it is recommended to report it to the Public Issue Tracker (PIT) [1] for product & service issues as well as feature requests.
[1] https://cloud.google.com/support/docs/issue-trackers
Reply all
Reply to author
Forward
0 new messages