OCR Grab is a lightweight screenshot utility designed for X11, built with C and GTK3. It allows users to select screen regions interactively and instantly extracts text using OCR powered by Tesseract. With features like dynamic cursors and clipboard integration, it streamlines text capturing workflows for efficient productivity.
OCR Grab is a powerful and efficient X11 screenshot utility designed to enhance productivity by seamlessly integrating Optical Character Recognition (OCR) capabilities. Developed in C using GTK3 and leveraging Tesseract for text extraction, this tool allows users to easily interact with their screen by selecting any region to capture and instantly convert it into text.
Key Features
- Interactive Region Selection: Easily select a screen area using click-and-drag functionality.
- Adjustment Mode: Resize and reposition the capture rectangle with precision after the initial selection.
- Dynamic Cursors: Benefit from context-aware mouse cursors that facilitate edge resizing, dragging, and accurate selection operations.
- Instant OCR: Experience real-time text extraction powered by the robust Tesseract engine through its C API, delivering results in just milliseconds.
- Clipboard Integration: Automatically copies extracted text to the clipboard, with a fallback for lightweight window managers (like i3 or dwm) utilizing
xclip.
Demo
A visual demo showcasing the functionality of OCR Grab can be found below:

Dependencies
To build and run OCR Grab, ensure you have a C compiler (like gcc), make, and the development headers for the following libraries installed:
gtk+-3.0tesseractleptonicazbarx11
For Ubuntu or Debian systems, the following command can be used to install the necessary packages:
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
Building the Project
Start by cloning the repository and compiling the project:
git clone https://github.com/talalalrwas/ocr-grab.git
cd ocr-grab
make
Upon successful completion, the executable ocr-grab will be available in the root directory of the project.
Usage Instructions
To execute the tool, run it from the terminal or bind it to a hotkey in your window manager (e.g., Mod+Print in i3):
./ocr-grab
Workflow:
- Draw: Click and drag to outline the desired text region.
- Adjust: Utilize corner or edge handles to refine your selection, or reposition the entire box by clicking inside it.
- Confirm: Press
Enterto finalize your selection and initiate the text extraction process. - Cancel: Press
Escapeto exit or discard the current operation.
After successful text extraction, a popup window will display the extracted content, which can be copied to the clipboard by selecting "Copy & Close."
OCR Grab stands out as an indispensable tool for users requiring quick and efficient text extraction from their screen, combining simple usability with powerful underlying technology.
No comments yet.
Sign in to be the first to comment.