https://github.com/funinkina/spectacle-ocr-screenshot
A simple utility to automatically extract text from spectacle on plasma desktops
https://github.com/funinkina/spectacle-ocr-screenshot
ocr ocr-recognition plasma plasma-desktop qt qt6 qt6-app qt6-widgets screenshot spectacle tesseract tesseract-ocr
Last synced: 3 months ago
JSON representation
A simple utility to automatically extract text from spectacle on plasma desktops
- Host: GitHub
- URL: https://github.com/funinkina/spectacle-ocr-screenshot
- Owner: funinkina
- License: mit
- Created: 2025-03-11T19:03:54.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-11T19:58:18.000Z (3 months ago)
- Last Synced: 2025-03-11T20:24:51.932Z (3 months ago)
- Topics: ocr, ocr-recognition, plasma, plasma-desktop, qt, qt6, qt6-app, qt6-widgets, screenshot, spectacle, tesseract, tesseract-ocr
- Language: Makefile
- Homepage:
- Size: 359 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spectacle OCR Screenshot
A simple Qt application that integrates KDE Spectacle screenshot tool with Tesseract OCR to extract text from screenshots.

## Features
- Capture screenshots using KDE's Spectacle tool
- Extract text from screenshots using Tesseract OCR
- Support for multiple languages
- Edit extracted text before saving
- Copy text to clipboard
- Save text to file## Requirements
- Qt 6.x
- Tesseract OCR
- Leptonica
- KDE Spectacle## Installation
### From Packages
You can download the pre-built packages from the [Releases Page](https://github.com/funinkina/spectacle-ocr-screenshot/releases/).
### Building from Source
1. Clone the repository:
```bash
git clone https://github.com/yourusername/spectacle-ocr-screenshot.git
cd spectacle-ocr-screenshot
```2. Install dependencies:
For Arch Linux:
```bash
sudo pacman -S qt6-base tesseract leptonica spectacle
```For Ubuntu/Debian:
```bash
sudo apt install qt6-base-dev libtesseract-dev libleptonica-dev spectacle
```For Fedora:
```bash
sudo dnf install qt6-qtbase-devel tesseract-devel leptonica-devel spectacle
```3. Build the project:
```bash
git clone https://github.com/funinkina/spectacle-ocr-screenshot
qmake6 simple.pro
make
```### You can also build using `cmake`:
Make sure you have cmake installed!```bash
mkdir build && cd build
cmake ..
make
```## Usage
Run the application:
```bash
./spectacle-ocr-screenshot
```## Recommended Usage
Create a symlink to the executable in your local `PATH` for easy access:```bash
sudo ln -s spectacle-ocr-screenshot /usr/local/bin/
```Then you can run the application from anywhere using or by assigning a keyboard shortcut to `spectacle-ocr-screenshot`
## The application will:
1. Launch Spectacle in region selection mode
2. After capturing, click on save, this will save to `/tmp`
3. The extracted text will be displayed in the application window
4. You can edit the text, copy it to clipboard or save it to a file### Command Line Options
- `--lang `: Specify the language(s) for OCR (default: eng)
- Use ISO 639-3 language codes
- For multiple languages, join them with '+' (e.g., `--lang eng+hin` for English and Hindi)Examples:
```bash
# Use English OCR (default)
./spectacle-ocr-screenshot# Use German OCR
./spectacle-ocr-screenshot --lang deu# Use multiple languages (English and Spanish)
./spectacle-ocr-screenshot --lang eng+spa
```## Available Languages
Tesseract OCR supports many languages. Some common language codes:
- `eng` - English
- `deu` - German
- `fra` - French
- `spa` - Spanish
- `ita` - Italian
- `rus` - Russian
- `jpn` - Japanese
- `kor` - Korean
- `chi_sim` - Chinese (Simplified)
- `chi_tra` - Chinese (Traditional)
- `ara` - Arabic
- `hin` - HindiYou may need to install language packs for Tesseract OCR separately.
## License
[MIT](https://github.com/funinkina/spectacle-ocr-screenshot/blob/main/LICENSE)