dingfeng.wong 5f0d1d63de add ocr
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00
2025-07-22 01:17:49 +08:00

Tooling

A collection of useful command-line tools.

OCR Screenshot Tool

A CLI tool that takes region screenshots on macOS, performs OCR using Tesseract, and copies the result to clipboard.

Prerequisites

  • macOS (uses built-in screencapture command)
  • Tesseract OCR (install with brew install tesseract)

Usage

Basic usage (takes screenshot, performs OCR, copies to clipboard):

uv run ocr-screenshot

With verbose output:

uv run ocr-screenshot --verbose

Save the screenshot image:

uv run ocr-screenshot --save-image

Specify OCR language (e.g., for Chinese):

uv run ocr-screenshot --lang chi_sim

How it works

  1. Screenshot: Click and drag to select a region, or press Space to capture an entire window
  2. OCR: The selected region is processed with Tesseract OCR
  3. Clipboard: The extracted text is automatically copied to your clipboard

Development Guide

How to Add New Packages

To add a new production dependency (e.g., 'requests'):

uv add requests

To add a new development dependency (e.g., 'ipdb'):

uv add --dev ipdb

After adding dependencies, always re-generate requirements.txt:

uv pip compile pyproject.toml -o requirements.txt

How to Build Packages

To build your project's distributable packages (.whl, .tar.gz):

python -m build

Or using the virtual environment directly:

./venv/bin/python -m build

Offline Build

To build offline packages for deployment:

./dev_scripts/build_offline.sh

This will create offline_packages/ with all dependencies and install.sh

S
Description
No description provided
Readme 3.2 MiB
Languages
Python 99.4%
Shell 0.6%