asyncio tesseract wrapper for Tesseract-OCR
Project description
aiopytesseract
asyncio tesseract wrapper for Tesseract-OCR.
Installing
Install and update using pip:
pip install aiopytesseract
Usage
from pathlib import Path
import aiopytesseract
# list all available languages by tesseract installation
await aiopytesseract.languages()
await aiopytesseract.get_languages()
# tesseract version
await aiopytesseract.tesseract_version()
await aiopytesseract.get_tesseract_version()
# confidence only info
await aiopytesseract.confidence("tests/samples/file-sample_150kB.png")
# deskew info
await aiopytesseract.deskew("tests/samples/file-sample_150kB.png")
# extract text from an image: locally or bytes
await aiopytesseract.image_to_string("tests/samples/file-sample_150kB.png")
await aiopytesseract.image_to_string(
Path("tests/samples/file-sample_150kB.png")read_bytes(), dpi=220, lang='eng+por'
)
# box estimates
await aiopytesseract.image_to_boxes("tests/samples/file-sample_150kB.png")
await aiopytesseract.image_to_boxes(Path("tests/samples/file-sample_150kB.png")
# boxes, confidence and page numbers
await aiopytesseract.image_to_data("tests/samples/file-sample_150kB.png")
await aiopytesseract.image_to_data(Path("tests/samples/file-sample_150kB.png")
# information about orientation and script detection
await aiopytesseract.image_to_osd("tests/samples/file-sample_150kB.png")
await aiopytesseract.image_to_osd(Path("tests/samples/file-sample_150kB.png")
# generate a searchable PDF
await aiopytesseract.image_to_pdf("tests/samples/file-sample_150kB.png")
await aiopytesseract.image_to_pdf(Path("tests/samples/file-sample_150kB.png")
# generate HOCR output
await aiopytesseract.image_to_hocr("tests/samples/file-sample_150kB.png")
await aiopytesseract.image_to_hocr(Path("tests/samples/file-sample_150kB.png")
# multi ouput
async with aiopytesseract.run(
Path('tests/samples/file-sample_150kB.png').read_bytes(),
'output',
'alto tsv txt'
) as resp:
# will generate (output.xml, output.tsv and output.txt)
print(resp)
alto_file, tsv_file, txt_file = resp
Links
- License: Apache License
- Code: https://github.com/amenezes/aiopytesseract
- Issue tracker: https://github.com/amenezes/aiopytesseract/issues
- Docs: https://aiopytesseract.amenezes.net
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiopytesseract-0.1.0.tar.gz
(14.8 kB
view hashes)
Built Distribution
Close
Hashes for aiopytesseract-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08a28d55379b13f49a7ec7f5334d6e5024766633c93e6e64332d8d31b2d243b0 |
|
MD5 | 861426914964cf7ce012e52955d8bd25 |
|
BLAKE2b-256 | c691b8605ecb510fca2edbb889627d9f3fbe19952fec07b077329b2c499a6bb0 |