gengns ES

An entry from the gengns log, written by Génesis García Morilla · · HTML5, JavaScript

Basic Optical Character Recognition with Tesseract

Choose an image with some text written to start detection.

Live demo no longer available.

JavaScript

const $div = document.querySelector('div')

document.querySelector('input[type="file"]').onchange = function() {
  const img = this.files[0]

  Tesseract.recognize(img)
    .progress(p => $div.textContent = p.progress)
    .then(r => $div.textContent = r.text)
}

HTML

<input type="file">
<div></div>
Open in JSFiddle

Tags: image, OCR, Tesseract, text