Metadata-Version: 2.4
Name: pysmartocr
Version: 1.3.0
Summary: Fast local OCR CLI using RapidOCR and ONNX Runtime
Author: MR-Kartoshki
License-Expression: MIT
Project-URL: Homepage, https://github.com/MR-kartoshki/SmartOCR
Project-URL: Issues, https://github.com/MR-kartoshki/SmartOCR/issues
Project-URL: Source, https://github.com/MR-kartoshki/SmartOCR
Keywords: cli,ocr,onnx,pdf,rapidocr
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics :: Capture :: Scanners
Classifier: Topic :: Text Processing
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<3,>=1.24
Requires-Dist: Pillow<13,>=10
Requires-Dist: rapidocr<4,>=3.9
Requires-Dist: onnxruntime<2,>=1.29
Requires-Dist: PyMuPDF<2,>=1.24
Dynamic: license-file

# smartocr

Fast, private OCR from the command line. Extract text from images and PDFs,
recognize dozens of languages, clean up difficult scans, or create searchable
PDFs without sending documents to an online service.

## Install

The recommended installation method is pipx:

```console
$ pipx install pysmartocr
```

You can also install it with pip:

```console
$ pip install pysmartocr
```

The package is named `pysmartocr`; the installed command is `smartocr`.

## Quick start

Extract text from an image:

```console
$ smartocr screenshot.png
```

Choose a language or let smartocr select one automatically:

```console
$ smartocr document.png --lang de
$ smartocr document.png --lang auto
```

Write the result to a file or copy it to the clipboard:

```console
$ smartocr scan.pdf --output text.txt
$ smartocr screenshot.png --copy
```

Create a PDF with selectable and searchable text:

```console
$ smartocr scan.pdf --searchable-pdf searchable.pdf
```

## Features

- Images and multi-page PDFs
- Automatic language selection
- 55 language and script variants
- Searchable PDF creation
- Optional scan enhancement, deskewing, rotation, thresholding, and scaling
- Plain text or JSON output
- Clipboard copying and standard-input support
- Automatic hardware acceleration when available
- Fully local processing

## Improve difficult scans

Use the general-purpose enhancement option first:

```console
$ smartocr faded-scan.png --preprocess
```

Additional controls can be combined as needed:

```console
$ smartocr crooked.png --deskew
$ smartocr low-contrast.png --threshold
$ smartocr sideways.png --rotate 90
$ smartocr small-text.png --scale 2
```

`--cpu` disables hardware acceleration if compatibility is more important than
speed.

## Use in scripts

Read an image or PDF from standard input by using `-` as the input name:

```console
$ cat screenshot.png | smartocr -
```

Request structured output:

```console
$ smartocr receipt.png --format json
$ smartocr receipt.png --format json --json-diagnostics
```

## Supported languages

Run `smartocr --list-languages` to see the language codes available in your
installed version.

- European and Latin-script: Azerbaijani (`az`), Czech (`cs`), Danish (`da`),
  Dutch (`nl`), English (`en`), Finnish (`fi`), French (`fr`), German (`de`),
  Hungarian (`hu`), Indonesian (`id`), Italian (`it`), Malay (`ms`), Norwegian
  (`no`), Polish (`pl`), Portuguese (`pt`), Romanian (`ro`), Serbian Latin
  (`sr-latn`), Spanish (`es`), Swedish (`sv`), Swahili (`sw`), Tagalog (`tl`),
  Turkish (`tr`), Uzbek (`uz`), Vietnamese (`vi`), and Kurdish Latin (`ku-latn`)
- Cyrillic: Belarusian (`be`), Bulgarian (`bg`), Kazakh (`kk`), Kyrgyz (`ky`),
  Macedonian (`mk`), Mongolian (`mn`), Russian (`ru`), Serbian (`sr`), Tajik
  (`tg`), and Ukrainian (`uk`)
- Arabic script: Arabic (`ar`), Persian (`fa`), Kurdish (`ku`), Pashto (`ps`),
  Sindhi (`sd`), Uyghur (`ug`), and Urdu (`ur`)
- South Asian: Hindi (`hi`), Marathi (`mr`), Nepali (`ne`), Bhojpuri (`bho`),
  Kannada (`kn`), Tamil (`ta`), and Telugu (`te`)
- East Asian: Simplified Chinese (`zh`), Traditional Chinese (`zh-tw`), Japanese
  (`ja`), and Korean (`ko`)
- Greek (`el`) and Thai (`th`)

Common language names and three-letter codes such as `english`, `eng`, `german`,
`deu`, and `jpn` are accepted too.

Automatic selection identifies the writing system and the best matching
recognizer. Languages that share the same alphabet may still need an explicit
language choice. The first use of a language can take longer while its required
files are downloaded.

## Help

```console
$ smartocr --help
```

Use `--debug` when troubleshooting recognition or performance problems.

## License

MIT
