Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tesseract.js-core

Package Overview
Dependencies
Maintainers
4
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tesseract.js-core

Tesseract C++ API in Pure Javascript

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is tesseract.js-core?

tesseract.js-core is a JavaScript library that provides core functionalities for optical character recognition (OCR) using the Tesseract OCR engine. It allows developers to extract text from images directly in the browser or in a Node.js environment.

What are tesseract.js-core's main functionalities?

Basic OCR

This code demonstrates how to perform basic OCR using tesseract.js-core. It initializes a worker, loads the necessary language data, and processes an image to extract text.

const TesseractCore = require('tesseract.js-core');
const { createWorker } = require('tesseract.js');

const worker = createWorker({
  corePath: TesseractCore
});

(async () => {
  await worker.load();
  await worker.loadLanguage('eng');
  await worker.initialize('eng');
  const { data: { text } } = await worker.recognize('path/to/image.png');
  console.log(text);
  await worker.terminate();
})();

OCR with Progress Updates

This code sample shows how to perform OCR with progress updates. The logger function is used to log progress messages to the console.

const TesseractCore = require('tesseract.js-core');
const { createWorker } = require('tesseract.js');

const worker = createWorker({
  corePath: TesseractCore,
  logger: m => console.log(m)
});

(async () => {
  await worker.load();
  await worker.loadLanguage('eng');
  await worker.initialize('eng');
  const { data: { text } } = await worker.recognize('path/to/image.png');
  console.log(text);
  await worker.terminate();
})();

OCR with Multiple Languages

This code demonstrates how to perform OCR on an image using multiple languages (English and Spanish in this case).

const TesseractCore = require('tesseract.js-core');
const { createWorker } = require('tesseract.js');

const worker = createWorker({
  corePath: TesseractCore
});

(async () => {
  await worker.load();
  await worker.loadLanguage('eng+spa');
  await worker.initialize('eng+spa');
  const { data: { text } } = await worker.recognize('path/to/image.png');
  console.log(text);
  await worker.terminate();
})();

Other packages similar to tesseract.js-core

Keywords

FAQs

Package last updated on 25 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc