ttmind

Main Navigation

ttmind
  • jim-jams
  • Tech
  • Positive
Login

Login

Facebook Google

OR

Remember me Forgot password?

Don't have account? Signup here.

Sort by Categorys

.Net

PHP

Java

JavaScript

Database

Server

Client Side

Tools

Artificial Intelligence

Cloud

Hybrid Development

Event

Smart City

Education

Security

Scrum

Digital Marketing

APP Development

Business

Internet

Simulation

Art

Network

Microservices

Architecture

Technology

Leadership

    Top Articles

  • How Does Social Media Bring People Together?
    TTMind Author
  • How to read appSettings JSON from Class Library in ASP.NET Core
    Anil Shrestha
  • Printing Support In Asp.Net Core
    TTMind Author
  • HOW TO EXTRACT TEXT FROM IMAGE USING JAVASCRIPT (OCR with Tesseract.js)?
    Prakash Pokhrel
  • Images Upload REST API using ASP.NET Core
    Prakash Pokhrel
  • Related Topic

  • Generate PDF from HTML with CSS by using JavaScript and JQuery
  • HOW TO EXTRACT TEXT FROM IMAGE USING Angular(OCR with Tesseract.js / OCR using Angular)?
  • Angular 7: Create new project using Angular 7
  • How to use the bootstrap(ngx-bootstrap) 4 in angular 7?
  • Validate a form in real time with JQuery Validation Plugin and Regex
  • Tech
  • About Us
  • Contact Us
  • TechHelp
  • PositiveHelp
  • Jim-Jams Help
  • Terms & Conditions

© Copyright ttmind.com

Main Content

HOW TO EXTRACT TEXT FROM IMAGE USING JAVASCRIPT (OCR with Tesseract.js)?

JavaScript Core JavaScript about 7 years ago || 9/28/2018 || 39.3 K View

  • Hide

What is OCR?

OCR (Optical Character Recognition) is the computer process, which helps to recognize printed text or written text characters into searchable and editable data. It involves

  • photo scanning of the text character-by-character,
  • analysis of the scanned-in image,
  • translation of the character image into character codes, such as ASCII, commonly used in data processing.

 

What is Tesseract.js?

Tesseract.js is a JavaScript based library for OCR, that extracts word from image. Now it is available in many languages. Like English, Spanish, Latin, Chinese etc.

Tesseract.js library is as follow:

<script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>

Let’s have look at simple example of OCR using tesseract.js.

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title> OCR DEMO</title>

</head>

<body>

        <img id="userImage" src="test.png"/>       

</body>

<script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>

<script>  

       var myImage= document.getElementById('userImage');

       Tesseract.recognize(myImage).then(function(result){

        console.log(result.text);

        alert(result.text);

        });

        </script>

</html>

In above example test.png is an image which text are going to extract.

OUTPUT:

For more visit : https://github.com/naptha/tesseract.js

  • 3
  • 0
  • 2
    • Facebook
    • Twitter
    • Google +
    • LinkedIn

About author

Prakash Pokhrel

Prakash Pokhrel

https://np.linkedin.com/in/prakash-pokhrel-42a699a2

Reset Your Password
Enter your email address that you used to register. We'll send you an email with your username and a link to reset your password.

Quick Survey