xavctn/img2table
img2table is a table identification and extraction Python Library for PDF and images, based on OpenCV image processing
What it solves
Extracting tables from scanned documents or PDFs is a common but tedious task. This library automates it by finding tables in images and PDFs and reading their contents, without requiring heavy neural-network models. It is designed to be simple to use and to run efficiently on CPU.
How it works
The library uses OpenCV for image processing to detect table borders and structures. For PDFs, pages are converted to images at 200 DPI first. It can also recognize borderless tables when enabled. To read cell text, it plugs into a variety of OCR tools (Tesseract, PaddleOCR, EasyOCR, etc.) or cloud services. The extracted tables are returned as objects that include a Pandas DataFrame representation, and can be exported directly to Excel files. It also supports options for detecting image rotation, identifying implicit rows and columns, and parallel processing.
Who it's for
Developers and data analysts who need to convert tables from images or PDFs into structured data. It is especially useful when you want a lightweight, CPU-friendly solution and prefer not to rely on neural networks. Users can choose among many OCR backends, including free local tools and cloud APIs.
Highlights
- Lightweight and CPU-friendly: uses OpenCV, so no heavy ML models needed.
- Supports many OCR engines: Tesseract, PaddleOCR, EasyOCR, docTR, RapidOCR, Surya, Google Vision, AWS Textract, and Azure.
- Handles complex table structures, like merged cells.
- Exports extracted tables to Excel files, preserving layout.
- Works with images, native PDFs, and scanned PDFs.
- Tunable options for borderless tables, implicit rows/columns, and rotation detection.
Related
- Project
- Project
- Project
- Project