Read all text from picture, one API call :Magical

If you are searching for a solution like : where you have to get all the text written over picture into readable text (response text) then you are at right place, more-over it’s not the limit.

– One REST call, just one line code

– And you get all the text in your image in JSON response text

Yayy !!! Thats the thing developers love πŸ˜‰

Steps you will follow to get the text out of your image:

1- Make a REST call with image url and token

2- Thats all !! DONE, get your result. Really.

There is a magic called scanR OCR API as a Service, Its open source, support 32 languages, provide you a token and first 100 REST calls/month free, if you want more you can buy their package that is really quite bearable as per the services.

What can you build with it?

  • Apps to scan documents, bills, business cards etc.
  • Scan and store all your promo-codes and paper offers.
  • Organize entire business documents into text files.
  • Anything else you can think of.

Let’s do it.

First you have to register on scanR, verify your email and come to the dashboard. There you would see 4 informations.

scanR1

Token is also there, that is most important here.

You can specify your language in parameter, although defualt is English.

You can use OCR in three ways:

1- Upload File: Use this option if you want to upload a file from your local machine.

2- Existing file URL: Use this option if your file is publicly accessed over the web.

3- PDF: In case you upload a pdf or send it’s url, and the pdf has more than one page thee response will be: {"text": ["text in first page", "text in second page"] }

Lets start using them one by one with example

Upload File

HTTP Request

POST : https://api.scanr.xyz/ocr?token=YOUR_TOKEN

Parameter Description Via
file The file you want to upload Multipart (POST)
lang The language to use. English is default. Optional. part of url param

Okay Open your advanced rest client (you can use others as well) in chrome browser, and fill the inputs as per this image:

scnaR

Response:

scanR-Response

Similar way you can use other two options as well like for

2- Existing file URL, put the image URL(web) instead of adding image.

You can make a CURL request as well from command line.

curl --data "url=https://i.imgur.com/fYY6P4Y.png" "https://api.scanr.xyz/ocr?token=YOUR_TOKEN&lang=eng"

How magical right !!! Have a look on their documentation.

I hope this post saved your hours.

Written by 

Rachel Jones is a Solutions Lead at Knoldus Inc. having more than 22 years of experience. Rachel likes to delve deeper into the field of AI(Artificial Intelligence) and deep learning. She loves challenges and motivating people, also loves to read novels by Dan Brown. Rachel has problem solving, management and leadership skills moreover, she is familiar with programming languages such as Java, Scala, C++ & Html.

2 thoughts on “Read all text from picture, one API call :Magical

Leave a Reply

%d bloggers like this: