Tools,

Extract text from an image in Python

97.7%

of 5,128 words right: RapidOCR, pip only

Get the code

RapidOCR: 3 lines, no extra program

pip install rapidocr onnxruntime
from rapidocr import RapidOCR

engine = RapidOCR()
print("\n".join(engine("photo.jpg").txts or []))

The code for the other 5 libraries is below.

30 images: PaddleOCR read the most words

Words right, in order. 10 JPGs a set.
Library Scans Screenshots Sideways photos
PaddleOCR 98.4% 99.3% 97.9%
RapidOCR 96.9% 100% 96.9%
ocrmac (Apple Vision, Mac only) 98.9% 93.4% 98.4%
docTR 95.4% 89.7% 61.4%
pytesseract (Tesseract 5.5) 96.1% 79.6% 0.3%
EasyOCR 82.1% 79.5% 0.1%

Sideways photos are made-up phone photos of a book page, drawn by a script with tilt, shadow and blur. They are stored turned, with an EXIF tag that says to turn them back. docTR found 94.9% of the sideways words, but out of order.

3 of 6 download models on first run

A new venv, Python 3.13, Mac with Apple silicon
Library pip download First run downloads
pytesseract 5.1 MB Nothing. Needs the Tesseract program
ocrmac 6.4 MB Nothing. macOS only
RapidOCR 88.2 MB Nothing
EasyOCR 225.8 MB 98.3 MB of models
PaddleOCR 228.2 MB 139.1 MB of models
docTR 235.5 MB 129.1 MB of models

After that, all 6 run offline. See offline OCR for the cache folders to copy. With torch or paddlepaddle, the venv is about 1 GB on disk.

Sideways phone photos: the 2-line fix

Pillow's Image.open ignores the EXIF tag, so pytesseract reads the photos sideways. EasyOCR finds the text on a sideways copy but reads an upright one. It stopped on 9 of 10, 8 times with:

cv2.error: OpenCV(5.1.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/imgproc/src/resize.cpp:3587: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

The fix:

from PIL import Image, ImageOps

img = ImageOps.exif_transpose(Image.open("photo.jpg"))

Pass img to pytesseract, or np.array(img) to EasyOCR.

Words right on the 10 sideways photos
Library As is With the fix
pytesseract 0.3% 33.1%
EasyOCR 0.1% 40.5%

pytesseract needs the Tesseract program

pip installs only the Python wrapper. With no tesseract on the PATH, the first call stops with:

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.

pytesseract was fastest, PaddleOCR slowest

Mean of 30 JPGs after the models load, a busy Mac
Library Seconds
pytesseract 1.7
ocrmac 2.2
EasyOCR (Mac GPU) 3.4
RapidOCR 5.0
docTR 13.8
PaddleOCR 94.4

EasyOCR used the Mac GPU, its default. Its 9 failed reads count here. The first run also loads the models: PaddleOCR took 381 s, with its download.

From Python, with no OCR install

PDF OCR to Markdown, our Apify Actor, reads image links and PDFs in the cloud. From Python, call it with the apify-client package.

The code for the other 5

pytesseract
pip install pytesseract pillow
from PIL import Image
import pytesseract

print(pytesseract.image_to_string(Image.open("photo.jpg")))
EasyOCR
pip install easyocr
import easyocr

reader = easyocr.Reader(["en"])
print("\n".join(reader.readtext("photo.jpg", detail=0)))
docTR
pip install python-doctr
from doctr.io import DocumentFile
from doctr.models import ocr_predictor

model = ocr_predictor(pretrained=True)
print(model(DocumentFile.from_images("photo.jpg")).render())
PaddleOCR
pip install paddlepaddle paddleocr
from paddleocr import PaddleOCR

ocr = PaddleOCR(use_doc_orientation_classify=False, use_doc_unwarping=False,
                use_textline_orientation=False)
print("\n".join(ocr.predict("photo.jpg")[0]["rec_texts"]))
ocrmac
pip install ocrmac
from ocrmac import ocrmac

for text, conf, box in ocrmac.OCR("photo.jpg").recognize():
    print(text)

What I did not test

How I tested it
  • The 30 JPGs of our JPG to text test: 10 proofread public domain book pages, 10 screenshots, and 10 phone photos drawn from the pages by a script, stored sideways.
  • Score: true words found in order.
  • Each library in its own new venv, Python 3.13.11, pip with an empty cache. Model downloads went to an empty home folder.
  • Versions: pytesseract 0.3.13 with Tesseract 5.5.4, EasyOCR 1.7.2, RapidOCR 3.10.0, docTR 1.1.0, PaddleOCR 3.7.0, ocrmac 1.0.1.
  • Each snippet ran once as printed, on one scan, and gave the same text as the bench. The bench set 2 threads where a library has a setting.
  • One library at a time, at low priority, on a Mac busy with other work. Short checks overlapped some runs. Seconds are rough: PaddleOCR ran when the Mac was busiest.
  • Our Actor's code, build 0.1.125, ran on the same 30 files on our Mac on November 23.
  • Scripts and results stay in our private repo, in research/bench/extract-text-image-python-2026-11-24/.
Sources

Questions people ask

How do I extract text from an image in Python without Tesseract?

Use a library that needs only pip. RapidOCR (pip install rapidocr onnxruntime) read 97.7% of 5,128 words on our 30 JPGs and downloaded nothing on its first run. EasyOCR, docTR and PaddleOCR download their models on the first run.

Which Python OCR library is the most accurate?

In our test, PaddleOCR read 98.4% of the words and RapidOCR 97.7%. pytesseract read 55.7%, as it failed on the sideways photos.

Why does pytesseract fail on phone photos?

A phone often stores a photo sideways, with an EXIF tag that says to turn it. Image.open ignores the tag, so Tesseract reads it sideways: 0.3% of the words. ImageOps.exif_transpose turns it upright (33.1%), but tilt and shadow still hurt Tesseract.