window.addEventListener("load", () => { // (A) FETCH IMAGE fetch("text.png") .then(res => res.blob()) .then(async (blob) => { // (B) CREATE ENGLISH TESSERACT WORKER const worker = await Tesseract.createWorker(); await worker.loadLanguage("eng"); await worker.initialize("eng"); // (C) RESULT const res = await worker.recognize(blob); document.getElementById("result").value = res.data.text; }) .catch(err => console.error(err)); });