Python OCR libraries

Updated Nov 2026

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.

Popularity

pytesseract has the most installs, while PaddleOCR has the most GitHub stars.

LibraryMonthly downloadsStarsLast releaseLicense
pytesseract
17.0M
6.4KAug 2024Apache-2.0
RapidOCR
3.8M
8.5KOct 2026Apache-2.0
EasyOCR
1.9M
30.1KSep 2024Apache-2.0
PaddleOCR
1.2M
92.4KJun 2026Apache-2.0
OCRmyPDF
1.1M
35.3KSep 2026MPL-2.0
tesserocr
429.3K
2.2KOct 2026MIT
doctr
204.7K
6.4KAug 2026Apache-2.0
keras-ocr
8.7K
1.5KNov 2023MIT
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Features compared

LibraryDetects tablesDetects page layoutReturns word boxesReads handwritingRuns on a GPUOutput formats
pytesseractUnsupportedVia pluginBuilt-inVia pluginUnsupportedText, TSV, PDF, hOCR
RapidOCRUndocumentedUnsupportedBuilt-inUndocumentedVia pluginMarkdown, JSON
EasyOCRUnsupportedUnsupportedBuilt-inUnsupportedBuilt-inJSON
PaddleOCRBuilt-inBuilt-inUnsupportedBuilt-inBuilt-inMarkdown, JSON
OCRmyPDFUnsupportedUnsupportedVia pluginUnsupportedVia pluginText, PDF
tesserocrUndocumentedVia pluginVia pluginUnsupportedUnsupportedText
doctrBuilt-inBuilt-inBuilt-inUnsupportedBuilt-inMarkdown, JSON
keras-ocrUndocumentedUndocumentedBuilt-inUndocumentedBuilt-inNot documented
Built-inVia pluginNot supportedNot documented

Libraries and code examples

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.

Quickstart

From the README
$ pip install pytesseract
from PIL import Image
import pytesseract

# Simple image to string
print(pytesseract.image_to_string(Image.open('test.png')))

pytesseract examples

From open-source projects on GitHub

Runs OCR on a stored image and returns text, boxes, word data, or hOCR with pytesseract.

Turns a page image into a searchable PDF with a hidden text layer using pytesseract.

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 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.

Quickstart

From the README
$ pip install rapidocr
from rapidocr import RapidOCR

engine = RapidOCR()

img_url = "https://www.modelscope.cn/models/RapidAI/RapidOCR/resolve/master/resources/test_files/ch_en_num.jpg"
result = engine(img_url)
print(result)

result.vis("vis_result.jpg")

RapidOCR examples

From open-source projects on GitHub

Runs RapidOCR on each page image and collects every word with its confidence and box.

Reads text from an image with RapidOCR and returns each line with its confidence and box.

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.

Quickstart

From the README
$ pip install 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')

EasyOCR examples

From open-source projects on GitHub

Runs EasyOCR readtext on each page image and turns the results into words with boxes.

Reads text from each page region with EasyOCR readtext and keeps cells above a confidence threshold.

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.

Quickstart

From the docs
$ pip install paddleocr
# 使用 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")

PaddleOCR examples

From open-source projects on GitHub

Extracts text from a PDF or image with PaddleOCR, rendering PDF pages to images first.

Runs PaddleOCR predict on page images and collects each recognized word with its score and box.

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.

Quickstart

From the docs
$ pip 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)

OCRmyPDF examples

From open-source projects on GitHub

Adds an OCR text layer to chosen PDF pages with ocrmypdf, straightening and rotating them first.

Cleans and OCRs a scanned invoice PDF with ocrmypdf and returns the new file path.

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.

Quickstart

From the README
$ pip install tesserocr
import tesserocr
from PIL import Image

image = Image.open('sample.jpg')
print(tesserocr.image_to_text(image))  # print ocr text from image
# or
print(tesserocr.file_to_text('sample.jpg'))

tesserocr examples

From open-source projects on GitHub

Reads text from an image with a shared tesserocr PyTessBaseAPI, guarded by a lock.

Recognizes the lines and words in a screenshot with tesserocr and keeps each one's bounding box.

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.

Quickstart

From the README
$ pip install python-doctr
from doctr.io import DocumentFile
from doctr.models import ocr_predictor

model = ocr_predictor(pretrained=True)
# PDF
doc = DocumentFile.from_pdf("path/to/your/doc.pdf")
# Analyze
result = model(doc)

doctr examples

From open-source projects on GitHub

Extracts text from a PDF or image with a docTR OCR predictor.

Runs a docTR predictor on page images and collects each word with its confidence and box.

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.

Quickstart

From the README
$ pip install keras-ocr
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)

keras-ocr examples

From open-source projects on GitHub

Reads text from a screenshot with a keras-ocr pipeline and returns each word with its box.

FAQ

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.

Tesseract is an optical character recognition engine maintained by Google. pytesseract, OCRmyPDF, and tesserocr all run it to read text. See the Tesseract documentation and the Tesseract repository.

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.

RapidOCR, EasyOCR, PaddleOCR, docTR, and keras-ocr run their own deep-learning models and never call Tesseract. tesserocr installs from prebuilt wheels that bundle Tesseract. pytesseract and OCRmyPDF need the Tesseract program installed 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.

Run in your terminal

claude plugin install exa@claude-plugins-official