Skip to main content

OCR Extractor

PyPI version Python versions License Downloads

A simple and efficient OCR-based data extraction tool for Indian PAN and Aadhaar cards using Tesseract OCR.

🆕 What's New in v0.1.3

  • Corrected example usage in README:
    • print(pan_data.get_pan())
    • print(aadhaar_data.get_aadhaar())
  • Includes all features from v0.1.2:
    • Added tesseract_cmd parameter to ExtractAadhaarData and ExtractPanData for custom Tesseract paths.
    • Fixed issue with preprocessing argument (preprocess) in child classes not being passed correctly.

(For full version history, see CHANGELOG.md)

✨ Features

  • Extract PAN card data with a single function call
  • Extract Aadhaar card data with a single function call
  • Built-in preprocessing option for better OCR accuracy
  • Cross-platform support (Windows, Linux, macOS) with configurable Tesseract path

📦 Installation

pip install ocr-pro

🚀 Usage

Extract PAN Card Data

from ocr import ExtractPanData

# Default usage (preprocess=False by default)
pan_data = ExtractPanData("pan_image.jpg", tesseract_cmd="/usr/bin/tesseract")

print(pan_data.get_pan())

Extract Aadhaar Card Data

from ocr import ExtractAadhaarData

# You can also enable preprocessing
aadhaar_data = ExtractAadhaarData("aadhaar_image.jpg", tesseract_cmd="/usr/bin/tesseract", preprocess=True)

print(aadhaar_data.get_aadhaar())

Arguments

  • filepath (str) → Path to the image file
  • tesseract_cmd (str, optional) → Path to the Tesseract executable (default: system auto-detection or "C:\Program Files\Tesseract-OCR\tesseract.exe" on Windows)
  • preprocess (bool, default=False) → Whether to apply preprocessing for better OCR results

⚙️ Requirements

📜 License

MIT License

Metadata

Release files for ocr-pro 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ocr-pro 0.1.3
File Size Uploaded
ocr_pro-0.1.3.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ocr-pro 0.1.3
File Interpreter ABI Platform
ocr_pro-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / ocr_pro-0.1.3.tar.gz

Download URL ocr_pro-0.1.3.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e4b99c5ce043fe0963b23430d268b9eec9f79e97dc6d7276e5a88dc55820b412
BLAKE2b-256 checksum
How to use checksums
6b3d710f36fa536fe7702ede8b3189d28bb5522115f2489d6bf8c499dba99ebd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / ocr_pro-0.1.3-py3-none-any.whl

Download URL ocr_pro-0.1.3-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcb8c25420f71d038214499e8cdf142aff237ff4d996bf30cf50ced73abb2081
BLAKE2b-256 checksum
How to use checksums
a72f23bc8db762918c3b01c315a9099970b8ffd0d57a7042f9369ad300c32ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page