Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
Python OCR (optical character recognition) libraries extract text from images and scanned documents. pytesseract passes each image to Tesseract, an OCR engine installed separately from Python. EasyOCR and PaddleOCR install with pip and bring their own deep learning models. The models download on first use and run faster on a GPU. These libraries turn scanned forms, receipts, and screenshots into text that search systems and AI agents can read.
pytesseract is a Python wrapper for Tesseract, Google's open source OCR engine. The wrapper passes each image to the Tesseract command-line program, which has to be installed separately and be on the system path. For plain text, image_to_string returns everything Tesseract read as one string. A second function, image_to_data, returns one row per word with its position on the image, a confidence value, and its line and page. Other functions turn the same image into a searchable PDF, hOCR, or ALTO XML.
Downloads / mo
17.0M
Stars
6.4K
Last release
0.3.13, Aug 2024
License
Apache-2.0
Runs on
Tesseract, installed separately
Strengths
Reads over 100 languages.Tesseract language packs cover more than 100 languages.
Text, boxes, or a searchable PDF.One call returns plain text, word boxes, TSV, or a searchable PDF.
Limitations
One process per call.Each call starts a new Tesseract process. tesserocr calls the engine's C++ API directly instead.
Installed languages only.Each language needs its Tesseract language pack, selected with the lang argument, such as lang='fra' for French.
def rehydrate_image_to_pdf(image: Image.Image, output_pdf_path: str):
"""
Converts an image to a single-page PDF with a hidden text layer using Tesseract.
This is the 'State Preservation' step.
"""
pdf_bytes = pytesseract.image_to_pdf_or_hocr(image, extension='pdf')
with open(output_pdf_path, 'wb') as f:
f.write(pdf_bytes)
RapidOCR
RapidOCR runs PaddleOCR's models after converting them to ONNX, a portable model format, so no PaddlePaddle install is needed. A single command, pip install rapidocr onnxruntime, installs everything. Calling the engine on an image path or URL returns the text it found with each box and score.
Downloads / mo
3.8M
Stars
8.5K
Last release
3.10.0, Oct 2026
License
Apache-2.0
Runs on
ONNX Runtime
Strengths
Choice of runtimes.Runs on ONNX Runtime, OpenVINO, PaddlePaddle, or PyTorch.
Runs on a CPU.A laptop or small server is enough.
Models included.pip install rapidocr onnxruntime, and three lines of Python read an image.
Limitations
Chinese and English by default.Other languages need a different model from the project's model list.
Training happens elsewhere.Custom models are fine-tuned in PaddleOCR and then converted for RapidOCR.
def run(self, im: Image.Image) -> list[dict]:
import numpy as np
res, _ = self.ocr(np.array(im.convert("RGB"))[:, :, ::-1])
out = []
for box, text, conf in res or []:
xs = [p[0] for p in box]
ys = [p[1] for p in box]
out.append({"text": str(text), "conf": round(float(conf), 3), "box": [int(min(xs)), int(min(ys)), int(max(xs)), int(max(ys))]})
return out
EasyOCR
EasyOCR reads text with deep learning models built on PyTorch and supports more than eighty languages, including Latin, Chinese, Arabic, Devanagari, and Cyrillic scripts. Model weights for each language download automatically the first time a reader is created. Its main method, readtext, returns a list in which each item holds a bounding box, the detected text, and a confidence level, which pytesseract gives only through image_to_data. Setting detail to zero returns the text alone.
Downloads / mo
1.9M
Stars
30.1K
Last release
1.7.2, Sep 2024
License
Apache-2.0
Runs on
PyTorch
Strengths
Works on messy images.Finds and reads text in one call, with little image cleanup.
Reads 80+ languages.Covers Latin, Chinese, Arabic, Devanagari, and Cyrillic scripts.
Short API.Create a Reader with a language list, then call readtext() on the image.
Limitations
GPU by default.Machines without a GPU, or with little GPU memory, need gpu=False when the reader is created.
No handwriting yet.The README lists handwritten text support as coming next.
PyTorch first on Windows.Windows needs PyTorch installed from the PyTorch site, with the matching CUDA version, before EasyOCR.
import easyocr
reader = easyocr.Reader(['ch_sim','en']) # this needs to run only once to load the model into memory
result = reader.readtext('chinese.jpg')
def of(self, document: Document | MockDocument) -> OCRData | None:
# ... # Get OCR of all images content = [self.reader.readtext(image) for image in document.images]
# Create dict of elements by page records = {}
for page, ocr_result in enumerate(content):
for idx, word in enumerate(ocr_result):
dict_word = {
"id": f"word_{page + 1}_{idx + 1}",
"parent": f"word_{page + 1}_{idx + 1}",
"value": word[1],
"confidence": round(100 * word[2]),
"x1": round(min([edge[0] for edge in word[0]])),
"y1": round(min([edge[1] for edge in word[0]])),
"x2": round(max([edge[0] for edge in word[0]])),
"y2": round(max([edge[1] for edge in word[0]])),
}
records.setdefault(page, []).append(dict_word)
return OCRData(records=records) if records else None
def __call__(
self, conv_res: ConversionResult, page_batch: Iterable[Page]
) -> Iterable[Page]:
# ... for page in page_batch:
assert page._backend is not None
if not page._backend.is_valid():
yield page
else:
with TimeRecorder(conv_res, "ocr"):
ocr_rects = self.get_ocr_rects(page)
all_ocr_cells = []
for ocr_rect in ocr_rects:
# ... high_res_image = page._backend.get_page_image(
scale=self.scale, cropbox=ocr_rect
)
im = numpy.asarray(high_res_image)
with warnings.catch_warnings():
# ... result = self.reader.readtext(im)
# ... cells = [
TextCell(
# ... )
for ix, line in enumerate(result)
if line[2] >= self.options.confidence_threshold
]
all_ocr_cells.extend(cells)
# ... self.post_process_cells(all_ocr_cells, page, conv_res)
# ... yield page
PaddleOCR
PaddleOCR is Baidu's OCR toolkit, built on the PaddlePaddle deep learning framework. Beyond reading lines of text, the toolkit converts PDFs and images into structured Markdown or JSON. Its PP-OCR models also read text in photos, such as IDs, street views, books, and industrial parts, and the README lists more than a hundred supported languages.
Downloads / mo
1.2M
Stars
92.4K
Last release
3.7.0, Jun 2026
License
Apache-2.0
Runs on
PaddlePaddle
Strengths
Reads 100+ languages.One model reads 50 languages, including Chinese, English, and Japanese.
Markdown or JSON with layout.PP-StructureV3 turns PDFs and images into Markdown or JSON, with positions.
Small models.Light enough for edge devices as well as servers.
Limitations
Two installs.The PaddlePaddle framework is installed separately from the paddleocr package, in a CPU or GPU build.
Lighter alternative.RapidOCR runs the same models without PaddlePaddle.
# 使用 PaddlePaddle 进行推理from paddleocr import TextDetection
model = TextDetection(engine="paddle")
output = model.predict("general_ocr_001.png")
for res in output:
res.print()
res.save_to_img(save_path="./output/")
res.save_to_json(save_path="./output/res.json")
def of(self, document: Document | MockDocument) -> OCRData | None:
ocrs = self.ocr.predict(input=document.images)
content = [
{
"rec_texts": res["rec_texts"],
"rec_scores": res["rec_scores"],
"rec_boxes": [bbox.tolist() for bbox in res["rec_boxes"]],
}
for res in ocrs
]
# Create dict of elements by page records = {}
for page, ocr_result in enumerate(content):
for idx, (word, conf, bbox) in enumerate(
zip(
ocr_result["rec_texts"],
ocr_result["rec_scores"],
ocr_result["rec_boxes"],
strict=True,
)
):
dict_word = {
"id": f"word_{page + 1}_{idx + 1}",
"parent": f"word_{page + 1}_{idx + 1}",
"value": word,
"confidence": int(100 * conf),
"x1": int(bbox[0]),
"y1": int(bbox[1]),
"x2": int(bbox[2]),
"y2": int(bbox[3]),
}
records.setdefault(page, []).append(dict_word)
return OCRData(records=records) if records else None
OCRmyPDF
OCRmyPDF is a command-line program, also callable from Python, that adds a hidden text layer to scanned PDF files so they can be searched and copied. Tesseract reads each page, and OCRmyPDF places that text beneath the page image while keeping the original images at their exact resolution. Options rotate misaligned pages, straighten crooked scans with --deskew, and spread the work across every CPU core.
Downloads / mo
1.1M
Stars
35.3K
Last release
17.13.0, Sep 2026
License
MPL-2.0
Runs on
Tesseract, installed separately
Strengths
Searchable PDF plus a text file.One run writes the searchable PDF and a separate text file.
Uses every CPU core.Spreads pages across cores, so long scans finish faster.
Keeps image quality.Adds the text layer without lowering image resolution.
Limitations
PDF output.The result is a searchable PDF/A file. Plain text needs the --sidecar option.
System install.Tesseract and its language packs are system programs, so the README recommends a package manager, such as apt install ocrmypdf.
import ocrmypdf
from ocrmypdf import OcrOptions
if __name__ == '__main__': # To ensure correct behavior on Windows and macOS
options = OcrOptions(
input_file='input.pdf',
output_file='output.pdf',
deskew=True,
languages=['eng'],
)
ocrmypdf.ocr(options)
def ocr(path, output, pages, language, progress=None):
"""Write `path` to `output` with the 0-based `pages` OCRed; their old text is replaced.
Pages are straightened and turned upright first. `progress(step, done, total)` follows
OCRmyPDF's steps; `done` and `total` count pages or are None."""
token = PROGRESS.set(progress)
try:
ocrmypdf.ocr(
path,
output,
language=language,
pages=",".join(str(i + 1) for i in pages),
mode="force",
rotate_pages=True,
rotate_pages_threshold=TURN_CONFIDENCE,
deskew=True,
clean=True,
# PDF/A sends the pages kept as they are through Ghostscript, which drops # the text of ligatures in some versions output_type="pdf",
progress_bar=progress is not None,
plugins=[__name__],
)
finally:
PROGRESS.reset(token)
def pre_process_pdf(path: str, pre_conf: dict[str, Any] | None = None) -> str | None:
# ... import ocrmypdf
ocrmypdf_conf = OPTIONS_DEFAULT.copy()
if pre_conf:
ocrmypdf_conf.update(pre_conf)
# ... if "output_file" not in ocrmypdf_conf:
# ... out_dir = tempfile.mkdtemp(prefix="invoice2data_ocrmypdf_")
ocrmypdf_conf["output_file"] = str(Path(out_dir) / Path(path).name)
# ... exit_code = ocrmypdf.ocr(path, **ocrmypdf_conf)
if exit_code == 0:
logger.info("Text extraction performed with ocrmypdf")
pre_proc_output = ocrmypdf_conf["output_file"]
# ... return pre_proc_output # Return the output file path
logger.warning("ocrmypdf failed, stopping processing of this file")
return None
tesserocr
tesserocr also runs Tesseract, but calls its C++ API directly through Cython instead of starting the command-line program. Unlike pytesseract, the library releases Python's global interpreter lock while Tesseract works, so several threads can read images at the same time. Pillow images and image files both work as input.
Downloads / mo
429.3K
Stars
2.2K
Last release
2.12.0, Oct 2026
License
MIT
Runs on
Tesseract, installed separately
Strengths
Runs OCR in parallel threads.Python threads can read several images at the same time.
Faster on many images.PyTessBaseAPI keeps Tesseract loaded between images.
Tesseract included.Prebuilt wheels for Linux, macOS, and Windows bundle Tesseract.
Limitations
Builds against Tesseract.Installing from source needs the Tesseract and Leptonica development libraries, such as libtesseract-dev and libleptonica-dev on Debian and Ubuntu.
def read_text(image, languages=None):
"""OCR text from an image."""
with lock:
api = None
currlocale = locale.getlocale()
try:
locale.setlocale(locale.LC_CTYPE, "C")
api = get_ocr()
if api is None or image is None:
return ""
api.SetImage(image)
return api.GetUTF8Text() or ""
finally:
if api is not None:
api.Clear()
locale.setlocale(locale.LC_CTYPE, currlocale)
def ocr_get_lines(
api: PyTessBaseAPI, *, image: Image.Image, filename: str, resolution: int
) -> tuple[list[OCRLine], bool]:
"""Recognize lines and their words without losing original image coordinates."""
from tesserocr import RIL, iterate_level # ruff: ignore[import-outside-top-level]
lines: list[OCRLine] = []
truncated = False
try:
try:
api.SetImage(image)
except RuntimeError:
return lines, truncated
api.SetSourceResolution(resolution)
with start_span(op="ocr.recognize", name=filename):
api.Recognize()
iterator = api.GetIterator()
# ... for word_number, word in enumerate(iterate_level(iterator, RIL.WORD)):
# ... try: # ruff: ignore[too-many-statements-in-try-clause]
if not lines or word.IsAtBeginningOf(RIL.TEXTLINE):
# ... lines.append(
{
"text": word.GetUTF8Text(RIL.TEXTLINE)[
:OCR_TEXT_LENGTH_LIMIT
],
"box": word.BoundingBox(RIL.TEXTLINE),
"words": [],
}
)
# ... except RuntimeError:
continue
finally:
api.Clear()
return lines, truncated
doctr
docTR reads documents in two stages: a detection model finds each word, and a recognition model reads its characters. Both stages run on PyTorch, and ocr_predictor lets a project choose the architecture for each one. PDFs and images both work as input, and the output groups words into lines, blocks, and pages.
Downloads / mo
204.7K
Stars
6.4K
Last release
1.1.0, Aug 2026
License
Apache-2.0
Runs on
PyTorch
Strengths
Finds and reads words.One predictor locates the words on a page, then reads them.
Exports searchable PDFs.Results export as text, JSON, hOCR, or a searchable PDF.
def of(self, document: Document | MockDocument) -> OCRData | None:
# ... # Apply OCR content = self.model(document.images)
# Create dict of elements by page records = {}
for page_id, page in enumerate(content.pages):
dimensions = page.dimensions
word_id = 0
for block in page.blocks:
for line_id, line in enumerate(block.lines):
for word in line.words:
word_id += 1
dict_word = {
"id": f"word_{page_id + 1}_{line_id}_{word_id}",
"parent": f"word_{page_id + 1}_{line_id}",
"value": word.value,
"confidence": round(100 * word.confidence),
"x1": round(word.geometry[0][0] * dimensions[1]),
"y1": round(word.geometry[0][1] * dimensions[0]),
"x2": round(word.geometry[1][0] * dimensions[1]),
"y2": round(word.geometry[1][1] * dimensions[0]),
}
records.setdefault(page_id, []).append(dict_word)
return OCRData(records=records) if records else None
keras-ocr
keras-ocr packages the CRAFT text detection model and a CRNN recognition model behind one TensorFlow pipeline. Creating a Pipeline downloads pretrained weights for both models. EasyOCR uses the same CRAFT detector on PyTorch, while keras-ocr also provides an API for training a custom detector and recognizer.
Downloads / mo
8.7K
Stars
1.5K
Last release
0.9.3, Nov 2023
License
MIT
Strengths
Train custom models.Includes a pipeline for training new detection and recognition models.
Finds and reads text in one pipeline.One pipeline object runs detection and recognition.
Works on first run.Downloads pretrained models automatically, with no training needed.
import keras_ocr
pipeline = keras_ocr.pipeline.Pipeline()
images = [
keras_ocr.tools.read(url) for url in [
'https://upload.wikimedia.org/wikipedia/commons/b/bd/Army_Reserves_Recruitment_Banner_MOD_45156284.jpg',
'https://upload.wikimedia.org/wikipedia/commons/e/e8/FseeG2QeLXo.jpg',
'https://upload.wikimedia.org/wikipedia/commons/b/b4/EUBanana-500x112.jpg'
]
]
# Each list of predictions in prediction_groups is a list of# (word, box) tuples.prediction_groups = pipeline.recognize(images)
pytesseract has 17.0M downloads a month and suits clean typed documents. PaddleOCR handles many languages, tables, and complex layouts, and OCRmyPDF turns scanned PDFs into searchable ones.
PaddleOCR reads hard images more accurately, and it returns tables and layout as Markdown or JSON. Tesseract, through pytesseract, suits clean typed pages and needs no deep-learning framework.
EasyOCR reads messy photos more accurately, with little image cleanup. Tesseract, through pytesseract, runs on a CPU without the large PyTorch install that EasyOCR needs.
PaddleOCR reads each image faster: 12.7 images a second against 4.2 for EasyOCR in one benchmark. EasyOCR starts up faster, so a script that reads a single image can finish first.
Open the image with Pillow and pass it to pytesseract.image_to_string(), which returns the text as a string. See the pytesseract quickstart. EasyOCR needs no Tesseract: create a Reader with a language list, then call readtext() on the image.
For coding agents
Found your OCR library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.