Spire.OCR for Python: High-Accuracy OCR API for Efficient Text Extraction from Images
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
Spire.OCR for Python is a robust and professional Optical Character Recognition (OCR) library designed to enable developers to extract text from images in various formats, including JPG, PNG, GIF, BMP, and TIFF. This library provides an intuitive and straightforward solution for integrating OCR capabilities into Python applications, allowing users to easily extract text from popular image formats.
Key Features
- Text Extraction: Extract text from images with support for commonly used fonts such as Arial, Times New Roman, Courier New, Verdana, Tahoma, and Calibri, in regular, bold, and italic styles.
- Multilingual Support: Recognize text in multiple languages, including English, Chinese, French, German, Japanese, and Korean, making it suitable for global applications.
- Image Format Compatibility: Supports extraction of text from a wide range of image file formats like JPG, PNG, BMP, GIF, and TIFF.
- Cross-Platform: Compatible with OCR feature on Windows, Linux and Mac operating systems.
- Easy Integration: Seamlessly integrate Spire.OCR for Python into your projects with a simple API that requires minimal coding effort.
Supported Languages:
- English
- Chinese
- Japanese
- Korean
- German
- French
Supported Fonts:
Commonly used fonts are supported, such as:
- Arial
- Times New Roman
- Courier New
- Verdana
- Tahoma
- Calibri
Supported Font Styles:
- Regular
- Bold
- Italic
Supported Image File Formats:
- JPG
- PNG
- BMP
- GIF
- TIFF
Installation
To install Spire.OCR for Python, you can use pip, the Python package manager. Simply run the following command:
pip install Spire.OCR
Or manually download Spire.OCR for Python and import it into your project.
Examples
Extract Text from an Image File
from spire.ocr import *
scanner = OcrScanner()
configureOptions = ConfigureOptions()
configureOptions.ModelPath = r"D:\OCR\win-x64"
configureOptions.Language = "English"
scanner.ConfigureDependencies(configureOptions)
scanner.Scan(r"Data\Sample.png")
#output the text and the blocks
text = scanner.Text.ToString() + "\n"
for block in scanner.Text.Blocks:
rectangle = block.Box
postions = f"{block.Text} -> x : {rectangle.X} , y : {rectangle.Y} , w : {rectangle.Width} , h : {rectangle.Height}"
text += postions + "\n"
with open('output.txt','a',encoding='utf-8') as file:
file.write(text+ "\n")
Extract Text from an Image Stream
from spire.ocr import *
scanner = OcrScanner()
configureOptions = ConfigureOptions()
configureOptions.ModelPath = r"D:\OCR\win-x64"
configureOptions.Language = "Japan"
scanner.ConfigureDependencies(configureOptions)
image_stream = Stream(r"Data\JapaneseSample.png")
image_format = OCRImageFormat.Png
scanner.Scan(image_stream,image_format)
text = scanner.Text.ToString()
with open('output.txt','a',encoding='utf-8') as file:
file.write(text)
Product Page 丨 Documentation 丨 Examples 丨 Forum 丨 Temporary License 丨 Customized Demo
Metadata
Release files for spire-ocr 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| spire_ocr-2.1.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| spire_ocr-2.1.0-py3-none-manylinux_2_31_x86_64.whl | Python 3 | none | Linux glibc 2.31+ x86-64 | Details |
| spire_ocr-2.1.0-py3-none-manylinux2014_aarch64.whl | Python 3 | none | Linux glibc 2.17+ ARM64 | Details |
| spire_ocr-2.1.0-py3-none-macosx_10_7_universal.whl | Python 3 | none | macOS 10.7+ universal (x86-64, i386, PPC64, PPC) | Details |
Total release size: 54.4 MB
Release files / spire_ocr-2.1.0-py3-none-win_amd64.whl
| Download URL | spire_ocr-2.1.0-py3-none-win_amd64.whl |
|---|---|
| Size | 11.1 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
401faa2934a5650aa3ada1f3651d710d2c66c34e1e623e5f0d66005fb5f980f4
|
|
BLAKE2b-256 checksum How to use checksums |
8be4ac7784c4280a91e06ce3bdf168b2ecaebbeaea78ef141a621a65ec4924de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / spire_ocr-2.1.0-py3-none-manylinux_2_31_x86_64.whl
| Download URL | spire_ocr-2.1.0-py3-none-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 11.2 MB |
| Tags | Linux glibc 2.31+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
eab7e126dabd77cef4fec1f2e256858ea9e2ae791919f9c248a1190419276eec
|
|
BLAKE2b-256 checksum How to use checksums |
da7c1876671831d08390c9af8aa3a882f9a2b7efd1b9a49327e7303403e4d875
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / spire_ocr-2.1.0-py3-none-manylinux2014_aarch64.whl
| Download URL | spire_ocr-2.1.0-py3-none-manylinux2014_aarch64.whl |
|---|---|
| Size | 10.6 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
926fce9222df2f8d2811d2b5fb39dab54024632ab0018c5df918bfafe1b2d716
|
|
BLAKE2b-256 checksum How to use checksums |
9df13a44fc997845ed90e0b4a4c414d9e4a98db71928e64ecac8c0aa24aead98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|
Release files / spire_ocr-2.1.0-py3-none-macosx_10_7_universal.whl
| Download URL | spire_ocr-2.1.0-py3-none-macosx_10_7_universal.whl |
|---|---|
| Size | 21.6 MB |
| Tags | Python 3 macOS 10.7+ universal (x86-64, i386, PPC64, PPC) |
|
SHA-256 checksum How to use checksums |
5695a5db24caa8c98fa982a2298bddc48ad5c907e83d0efc08f7befef40749a5
|
|
BLAKE2b-256 checksum How to use checksums |
f1dc5fccbfbbecb1788d175d5b5624bdf6ec7805e86853f01b9533eed488f1b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.11
|