Skip to main content

WinRT OCR: Take advantage of powerful existing Windows tool

GitHub License GitHub last commit Stars

If you find this repo helpful, please leave me a star, thanks!!!

Overview

WinRT OCR is a Python wrapper for using OCR API from Windows Runtime (WinRT) on Windows operating system.

1. What is Windows Runtime (WinRT) API?

Windows Runtime is an integrated software module deeply in Windows system, first introduced after Windows 8 released. It can be simply understood as set of APIs and rules to build functions in Windows apps.

Through APIs it provides, the developers can interact with modern functions of Windows such as location detection, camera, Bluetooth, and so on.

See more APIs

2. Which version of Windows supports WinRT API ?

It's highly recommended to use Windows 10, version 1803 or later.

The older version may lead to unwanted behaviors or no longer supported syntax.

3. Which language does it support to OCR?

Up to this point, WinRT has supported for several languages:

Code Language
ar-SA Arabic (Saudi Arabia)
bg-BG Bulgarian (Bulgaria)
bs-LATN-BA Bosnian (Latin, Bosnia and Herzegovina)
cs-CZ Czech (Czech Republic)
da-DK Danish (Denmark)
de-DE German (Germany)
el-GR Greek (Greece)
en-GB English (United Kingdom)
en-US English (US)
es-ES Spanish (Spain)
es-MX Spanish (Mexico)
fi-FI Finnish (Finland)
fr-CA French (Canada)
fr-FR French (France)
hr-HR Croatian (Croatia)
hu-HU Hungarian (Hungary)
it-IT Italian (Italy)
ja-JP Japanese (Japan)
ko-KR Korean (South Korea)
nb-NO Norwegian Bokmål (Norway)
nl-NL Dutch (Netherlands)
pl-PL Polish (Poland)
pt-BR Portuguese (Brazil)
pt-PT Portuguese (Portugal)
ro-RO Romanian (Romania)
ru-RU Russian (Russia)
sk-SK Slovak (Slovakia)
sl-SI Slovenian (Slovenia)
sr-CYRL-RS Serbian (Cyrillic, Serbia)
sr-LATN-RS Serbian (Latin, Serbia)
sv-SE Swedish (Sweden)
tr-TR Turkish (Turkey)
zh-CN Chinese (Simplified, China)
zh-HK Chinese (Traditional, Hong Kong SAR)
zh-TW Chinese (Traditional, Taiwan)

Recent Update

  • 🚀 2025/04/12: Release the first version.

Quick Start

Dependencies:

  • Python >= 3.8
  • Windows 10, version 1803 or higher
pip install winrt-ocr-python

NOTICE:

Before you continue, check your computer to ensure that your expected language has been installed for OCR.

Open Powershell as Administrator then run this cell:

# This line will list all of language it supports for OCR (or you can see in table above)
Get-WindowsCapability -Online | Where-Object { $_.Name -Like 'Language.OCR*' }

# Download your target language (such as fr-FR)
Get-WindowsCapability -Online | Where-Object { $_.Name -Like 'Language.OCR*fr-FR*' } | Add-WindowsCapability -Online

This will look for the OCR language package in Window Update (WU) host then download it. It may take a few time to finish.

Check C:/Windows/OCR to see that your language has been installed or not yet. If an OCR pack is supported and installed but different location, for example, X:/Windows/OCR, then just copy X:/Windows/OCR folder to C:/Windows/OCR folder.

Usage:

import asyncio
from winrtocr import WinRTOCR

engine = WinRTOCR()
img_path = "/path/to/img_file"
output_lines = asyncio.run(engine.ocr(img_path, lang="en-US", detail_level='line'))

# (Optional) Show languages support
engine.available_languages

# Visualize the result
# NOTE: image MUST BE str, BGR or BGRA
test_img = engine.draw_ocr_result(img_path, output_lines, detail_level='line')

Acknowledgement

This library is built based on PyWinSDK. Thank for their great jobs!

Metadata

Release files for winrt-ocr-python 0.1.1

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

Source distribution (sdist)

Source distribution for winrt-ocr-python 0.1.1
File Size Uploaded
winrt_ocr_python-0.1.1.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for winrt-ocr-python 0.1.1
File Interpreter ABI Platform
winrt_ocr_python-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / winrt_ocr_python-0.1.1.tar.gz

Download URL winrt_ocr_python-0.1.1.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0bb9b3c9a143f12fc42e823693485ea71c2084063a5ed270537f18b177c7268f
BLAKE2b-256 checksum
How to use checksums
229129a39ff3087b94100369632b3c5fdbddaa1856ed9a2ef22d4414bcfbe586
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2025.

Transparency log

Release files / winrt_ocr_python-0.1.1-py3-none-any.whl

Download URL winrt_ocr_python-0.1.1-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c51f8e0856f043b0c6ad2f1187f5492d519558444edde54b3ec650a7e003e26e
BLAKE2b-256 checksum
How to use checksums
1f5c4802986c03c555891b50ebe2565a559e46759f2ceda2ec2a5c24686a8f52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 12, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

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