A lightweight, blazing fast X11 screenshot utility built in C with GTK3 and Tesseract. OCR Grab allows you to interactively select a region of your screen, just like Flameshot, and instantly extracts text from that region straight to your clipboard.
Demo
Features
- Interactive Region Selection: Click and drag to define your selection.
- Adjustment Mode: Precisely resize and reposition the capture rectangle after your initial drag.
- Dynamic Cursors: Context-aware mouse cursors for edge resizing, dragging, and selecting.
- Instant OCR: Uses the powerful Tesseract engine (via the C API) to convert images to text in milliseconds.
- Clipboard Integration: Automatically copies the result to your system clipboard. Contains a fallback mechanism for bare-bones Window Managers (like i3 or dwm) utilizing
xclip.
Dependencies
You'll need a C compiler (gcc), make, and the development headers for the following libraries:
gtk+-3.0tesseractleptonicazbarx11
Ubuntu / Debian:
sudo apt update sudo apt install build-essential pkg-config libgtk-3-dev libtesseract-dev libleptonica-dev libzbar-dev libx11-dev xclip tesseract-ocr-eng
(Note: tesseract-ocr-eng provides the english language training data).
Building
Clone the repository and run make:
git clone https://github.com/talalalrwas/ocr-grab.git
cd ocr-grab
makeThis will produce the ocr-grab executable in the project root.
Usage
Run the tool from your terminal or bind it to a hotkey in your window manager (e.g. Mod+Print in i3).
- Draw: Click and drag to draw a box around the text.
- Adjust: Drag the corners or edges to refine the selection, or click inside to move the entire box.
- Confirm: Press
Enterto finalize the selection and extract text. - Cancel: Press
Escapeto discard the current selection or exit the tool entirely.
When the text is successfully extracted, it will be displayed in a popup window. Clicking "Copy & Close" will save the result to your primary and selection clipboards.
License
This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.



























