Skip to content

Examples

gregjurman edited this page Aug 14, 2011 · 5 revisions

Basic Examples

These examples will get you up and running with Tesserwrap quickly.

OCRing an image in one-shot

If you need to quickly OCR an entire image (eg. a page of text) the ocr_image function will send the entire image to Tesseract and return a string of the contained data. Currently Tesserwrap can only handle gray-scale images and will convert any image you give it to gray-scale.

import Image
from tesserwrap import tesseract

# Open an image
im = Image.open("test.png")

# Create a Tesseract object
tw = tesseract()

# OCR the image and return a string
print tw.ocr_image(im)
Clone this wiki locally