[Solved] How to fix OCR saying my file exceeds the size limit?

Hey everyone! When I take a picture and try to see what the OCR output is, I get an error message like this:
“{“OCRExitCode”:3,“IsErroredOnProcessing”:true,“ErrorMessage”:[“File failed validation. File size exceeds the maximum size limit. Maximum size limit 1024 KB”],“ErrorDetails”:”",“ProcessingTimeInMilliseconds”:“31”}"

Can anybody help me?

2 Likes

Hi @aishat.yatarovarxr which API are you using for OCR?

What does their documentation say about this error?

1 Like

I did this using Barcode Scanner - Round About Way using OCR
I did it in the new UI btw

1 Like

Ohh…are you trying to create a barcode scanner?

1 Like

The same question is being posted again

See this post

Nope, I am trying to make a function that reads text and outputs it. But Barcode Scanner - Round About Way using OCR seemed like it was the closest to what I wanted. They said that this could also be used with text, so that is why I tried it.

These are my blocks, is anything wrong with them? This is the web API url that I am using: https://api.ocr.space/parse/imageurl?apikey=YOURAPIKEY&url=

Most APIs will return a response in JSON. You’ll need to convert the JSON to an object and then get a property value from that object.

To learn how to do this, watch my tutorial video:

I have tried to insert my url into a web browser and it is giving me the same error message as before, which means I can not do any further actions yet:
“{“OCRExitCode”:3,“IsErroredOnProcessing”:true,“ErrorMessage”:[“File failed validation. File size exceeds the maximum size limit. Maximum size limit 1024 KB”],“ErrorDetails”:”",“ProcessingTimeInMilliseconds”:“31”}"

What should I do now?

Can you share the full URL with me in a PM, so I can check it out?

I thought you were not allowed to share it with anyone

No, you are allowed. That is mostly for PlayStore apps. It’s not the best practice to do that IF YOU ARE DO NOT NEED HELP WITH YOUR APP. It’s hard helping you without your full URL.

If you share a URL that includes an API key, that allows the other person to access and test those settings and help you. But it also gives them access to make calls to that API as you. The main problem with that is if the API charges you per call, you will be paying for each of those calls made by the other person.

So I would recommend sharing a paid API key only with someone you trust. (Or, in some cases it doesn’t matter a ton because each call is $0.0007 or something and even if that person makes 100 calls to the API, it’s only going to cost you $0.07 :laughing:).

1 Like

Hey again! For some reason, my ocr only works with an image from library (mostly screenshots), but doesn’t work with a photo from camera. What do you think the problem might be?

What do the green error blocks show? Set a label to those and see what errors are displayed.

Hi there,

It sounds like your camera is taking pictures that are larger and of higher quality, so the size of the photo exceeds the 1024 KB/1MB file size limit for this API. Screenshots you have saved to your device would be smaller and lower quality, so they fit the size limit.

Are you able to turn your camera quality way down and see if that makes it possible to upload your image to this API?

Since you are uploading your image to Cloudinary using our Media DB component, you can get the resulting URL that points to the image and manipulate the URL to point to a smaller version of this image. So maybe the original 1000 * 2000 pixel image you took on your camera is too large to upload, but if you resized it to be 200 * 400 pixels it would fit the API’s size limits. (These are made up numbers, try different sizing options for yourself!)

You can read about resizing images in Cloudinary using URLs here.

As explained in this link, you only need to set one parameter, height or width, and the image will be scaled down automatically. This might be best to make sure you don’t distort your image.

So you could use blocks like this to resize your image before appending it to your Web API URL. Try different widths to see what works for you:

As I was writing this, it occurred to me that I have seen similar blocks advised in the Community relatively recently. If you are reading this and you wrote or saw another post that explained resizing images with Cloudinary URLs, let me know and I will link to the post as well!

2 Likes

Thank you so much!! This is what I had been needing this whole time, you helped me out a lot!!

1 Like

I’m glad that answer was helpful! :grin: