# Tesseract.js v5.0.0 - Product: Tesseract.js (https://whatsnew.fyi/product/tesseract-js) - Vendor: naptha - Date: 2023-09-28 - Version: v5.0.0 - Original notes: https://github.com/naptha/tesseract.js/releases/tag/v5.0.0 - Permalink: https://whatsnew.fyi/product/tesseract-js/releases/v5.0.0 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. --- - **changed** — File sizes reduced by 54% for English and 73% for Chinese - **changed** — Worker memory utilization reduced from 311 MB to 164 MB (47% reduction) - **fixed** — Made compatible with iOS 17 - **changed** — Language and OEM arguments now set in createWorker instead of loadLanguage and initialize - **changed** — worker.initialize and worker.loadLanguage functions now do nothing - **added** — worker.reinitialize function to reinitialize workers with different settings - **changed** — corePath directory must now contain all 4 core files (tesseract-core.wasm.js, tesseract-core-simd.wasm.js, tesseract-core-lstm.wasm.js, tesseract-core-simd-lstm.wasm.js) - **changed** — worker.detect function disabled by default, requiring legacyCore and legacyLang options to enable - **changed** — Language data loaded from jsdelivr by default instead of GitHub pages - **removed** — Separate development build that produced tesseract.dev.js and worker.dev.js ##### What's Changed ##### Major New Features 1. **Significantly** smaller file sizes 1. 54% smaller file sizes for English, 73% smaller for Chinese (see #806 for details) 2. This results in a **~50% decrease** in runtime for first-time users (who do not yet have the data downloaded/cached) 1. Significantly lower memory usage 1. Worker memory utilization in the [web benchmark](https://github.com/naptha/tesseract.js/blob/dev/v5/benchmarks/browser/speed-benchmark.html) is reduced from 311 MB to 164 MB (47% reduction) 2. The lower memory footprint makes it feasible to use more workers, significantly improving performance for projects that utilize [schedulers](https://github.com/naptha/tesseract.js/blob/master/docs/intro.md) for parallel processing 1. Compatible with iOS 17 (using default settings) 1. iOS 17 broke compatibility with Tesseract.js v4--upgrading to v5 should resolve 1. See discussion section below for details ##### Breaking Changes Impacting Many Users 1. `createWorker` arguments changed 1. Setting non-default language and OEM now happens in `createWorker` 1. E.g. `createWorker("chi_sim", 1)` 1. `worker.initialize` and `worker.loadLanguage` functions now do nothing and can be deleted from code 1. Loading the language and initialization now occurs in `createWorker` 4. Workers can be re-initialized with different settings using `worker.reinitialize` In other words, code should be modified from this: ``` const worker = await Tesseract.createWorker(); await worker.loadLanguage('eng'); await worker.initialize('eng'); const ret = await worker.recognize(file); ``` To this: ``` const worker = await Tesseract.createWorker("eng"); const ret = await worker.recognize(file); ``` ##### Breaking Changes Impacting Fewer Users 1. Users who manually set `corePath` will need to update the contents of their `corePath` directory 1. `corePath` should point to a directory that contains **all 4** of the files below from Tesseract.js-core v5: 1. `tesseract-core.wasm.js` 2. `tesseract-core-simd.wasm.js` 3. `tesseract-core-lstm.wasm.js` 4. `tesseract-core-simd-lstm.wasm.js` 1. Tesseract.js will automatically select the correct version to use 1. `worker.detect` function disabled by default 1. Orientation + script detection is a function of the Legacy model only, which is no longer included by default 6. To enable, set arguments `legacyCore: true` and `legacyLang: true` in `createWorker` options 1. E.g. `Tesseract.createWorker("eng", 1, {legacyCore: true, legacyLang: true});` 1. Language of progress logs standardized 1. This should only impact users who parse status logs (e.g. to update a loading bar) ##### Non-Breaking Changes 1. Language data loaded from `jsdelivr` by default (rather than GitHub pages) 1. This should result in improved performance and uptime 1. Separate "development" build (that produced `tesseract.dev.js` and `worker.dev.js` removed 1. Documentation and examples were modified to prevent new users from using `Tesseract.recognize` and `Tesseract.detect` 1. Users who already use these functions are encouraged to modify their code to use `worker.recognize` and `worker.detect` instead Considering upgrading from v2 to v5? See #771 for a full guide for updating. **Full Changelog**: https://github.com/naptha/tesseract.js/compare/v4.1.3...v5.0.0