Skip to main content

Spire.OCR for Python is a professional OCR component used to read text in image formats such as JPG,PNG,GIF,BMP, and TIFF

Project description

Spire.OCR for Python: High-Accuracy OCR API for Efficient Text Extraction from Images

Spire.OCR for Python

Product PageDocumentationExamplesForumTemporary LicenseCustomized 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 PageDocumentationExamplesForumTemporary LicenseCustomized Demo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

spire_ocr-1.9.13-py3-none-win_amd64.whl (11.3 MB view details)

Uploaded Python 3Windows x86-64

spire_ocr-1.9.13-py3-none-manylinux_2_31_x86_64.whl (11.4 MB view details)

Uploaded Python 3manylinux: glibc 2.31+ x86-64

spire_ocr-1.9.13-py3-none-manylinux2014_aarch64.whl (10.7 MB view details)

Uploaded Python 3

spire_ocr-1.9.13-py3-none-macosx_10_7_universal.whl (21.9 MB view details)

Uploaded Python 3macOS 10.7+ universal (x86-64, i386, PPC64, PPC)

File details

Details for the file spire_ocr-1.9.13-py3-none-win_amd64.whl.

File metadata

  • Download URL: spire_ocr-1.9.13-py3-none-win_amd64.whl
  • Upload date:
  • Size: 11.3 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for spire_ocr-1.9.13-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a3cd3e9c66ac45c3b697d6bc2f8d946a07f02a1984461caef0b28d59b31039eb
MD5 8b230532c3870d112e1b968c3f98b63a
BLAKE2b-256 1ade82f326437eaafb1b15b7e28de4a5d79ac6ca1f6985801d839c2d833d42a5

See more details on using hashes here.

File details

Details for the file spire_ocr-1.9.13-py3-none-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for spire_ocr-1.9.13-py3-none-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 d7fc57ffa9396ee0ac927f88fcfbab6d62b7d39214c3efb344dc64d3327446e7
MD5 5a8ef224bbf72f1e05acef24c1bf8098
BLAKE2b-256 e61dcc916839530fb06ca65cd9d7956cf2f9639c6a9b5159f632ff8c59968c85

See more details on using hashes here.

File details

Details for the file spire_ocr-1.9.13-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for spire_ocr-1.9.13-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e114996bc00b751fcd8df161759b4e435f98e01c0482d68a2e42907b20ac8e36
MD5 915d4cbd253dc2c058ae37c39a0deec6
BLAKE2b-256 9bbf9850d308594712362811918b0488596cfdded2650d5350bb9f55f3408fd8

See more details on using hashes here.

File details

Details for the file spire_ocr-1.9.13-py3-none-macosx_10_7_universal.whl.

File metadata

File hashes

Hashes for spire_ocr-1.9.13-py3-none-macosx_10_7_universal.whl
Algorithm Hash digest
SHA256 6d47965099eafa3389bea7f92dc1923671d8ba3d3a43588d831b98afab749a99
MD5 11b69688f7ad6a46d22387d7028353b0
BLAKE2b-256 dba15c60d74a4b0d890f17217e0d6d974c8bc0e25a609ea56537bc3b367a351d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page