Tesseract.js – JavaScript OCR Library to Translate Images to any Language

OCR is a very handy tool when we have a lot of scanned content and want all to be converted to a word or text format. But the major problem with OCR is the translation, it is not to our expectation level.

Tesseract.js is a superb Javascript library that supports over 60 languages translation and detection.

Nothing is perfect in the world similarly you can say Tesseract.js also lacks accuracy but in most cases, it comes up with the solution and meets our requirements.

tesseract.js

So let’s learn more about Tesseract.js and how to configure it to compress & translate our images.

How to Use Tesseract.js?

We now know about tesseract.js that can convert almost any word to any language right in our browser. Using tesseract is easy as we have the javascript version the library. Let’s see its usage.

Include the script in your web page by downloading it from the GitHub Repository

OR

Tesseract.js CDN:

It’s a good news that the tesseract.js has a CDN (content distribution network ) that can directly be distributed in the <head> section.

The code to compress and translate the image is very simple.

Here, in the above code (myImage) implies to an HTML image element.

Recommended Readings:

Going further to another example.

If you are aware that your image contains Russian words then you can add the option in the lang property with a value like ‘rus‘ for the Russian Language.

Here is the list of some important languages option that you can take care of.

ara Arabic
ces Czech
chi_sim Chinese
deu German
fra French
hin Hindi
ita Italian
nld Dutch
por Portuguese
spa Spanish
swe Swedish
ukr Ukrainian

Similarly, for more language parameters you can refer to the Docs of the library in the GitHub repository.

This was a very simple example of using Tesseract.js and translate any language images to the proper text format for copying and pasting.

For more information and demo of the what Tesseract.js can do you can go here.

(Visited 374 times, 1 visits today)
Share is Caring...!
This entry was posted in Web Design and tagged , , , , , . Bookmark the permalink.
Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.
Tuluzz.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for website owners to earn advertising fees by advertising and linking to Amazon(.com, .co.uk, .ca etc) and any other website that may be affiliated with Amazon Service LLC Associates Program.

Leave a Reply