Nim Tesseract is a Nim wrapper for the Tesseract OCR library, via its dynamic library.
$ nimble install nimtesseract
- Install (lib)tesseract via your package manager or put the tesseract so/dll/dylib file in the project directory E.g. for Arch Linux:
$ pacman -Sy tesseract
for macOS:
$ brew install tesseract
- Download trained data from https://github.com/tesseract-ocr/tessdata or https://github.com/tesseract-ocr/tessdata_fast
- Done ✅
import nimtesseract
echo imageToText("file.png")
More examples in the examples folder
Download trained data and put it into src folder
⚠️ Outdated, but still useful. Don't refer to this.$ cd src $ TESSDATA_PREFIX=$(pwd) nim r -d:pixieUseStb nimtesseract.nim
Run tests with nimble:
$ nimble test
capi.h
reference: https://github.com/tesseract-ocr/tesseract/blob/main/include/tesseract/capi.h
Inspired from https://github.com/Altabeh/tesseract-ocr-wrapper
This project is under the Unlicense
license.
This is free and unencumbered software released into the public domain.