A simple OCR (Optical Character Recognition) tool for the GNOME desktop environment that allows you to extract text as well as scan QR codes directly automatically from screenshots.
- Uses native GNOME screenshot portal
- Minimal Dependencies (pytesseract and pyzbar only)
- Single file for easy shortcut setup
- Ability to scan QR codes without any additional setup
- Can save as file directly
- Can copy to clipboard directly
- Supports multiple languages
- Customizable save location
- Customizable keyboard shortcuts
- Python 3.x (Preinstalled on most Linux distributions)
- GTK 4 (Preinstalled on GNOME-based distributions)
- Python Tesseract OCR (See below for installation instructions)
- pyzbar (optional, for QR code scanning)
# Ubuntu/Debian
sudo apt install tesseract-ocr
# Fedora
sudo dnf install tesseract
sudo dnf install python3-pytesseract
# Arch Linux
sudo pacman -S tesseract
sudo pacman -S python-pytesseract
# Using builtin python package manager
pip install pytesseract
# Ubuntu/Debian
sudo apt-get install libzbar0
sudo apt install python3-pyzbar
# Arch Linux from AUR
yay -S pyzbar
#Using builtin python package manager
pip install pyzbar
# Example for hindi language support
sudo apt install tesseract-ocr-hin # Ubuntu/Debian
sudo dnf install tesseract-langpack-hin # Fedora
sudo pacman -S tesseract-data-hin # Arch Linux
Basic usage:
python gnome-ocr-screenshot.py
Move the script to a directory in your PATH and create keyboard shortcut for quick access.
git clone https://github.com/funinkina/Gnome-OCR-Screenshot
cd Gnome-OCR-Screenshot
sudo cp gnome-screenshot-ocr.py /usr/local/bin/gnome-screenshot-ocr
# alternatively, you can create a symbolic link
ln -s gnome-screenshot-ocr.py /usr/local/bin/gnome-screenshot-ocr
sudo chmod +x ~/.local/bin/gnome-screenshot-ocr
- Open GNOME settings
- Go to Keyboard Shortcuts
- Add a new shortcut with the command
gnome-screenshot-ocr
with the appropriate arguments (see below) - Assign a key combination to the shortcut, for example:
Meta+PrintScreen
.
--help
: Show help message and exit.--enablesaving
: Keep the screenshot file after text extraction.--nocloseonaction
: Keep the application running after saving text or copying to clipboard.--lang
: Specify OCR language(s) (e.g.,--lang eng+deu
for English and German). Default is all the available languages of Tesseract data installed on your system.--save-location
: Set default directory for saving text files (e.g.,--save-location ~/Documents
). Default is the user's documents directory.
Example with options:
gnome-screenshot-ocr --lang eng+deu --save-location ~/Documents
- Launch the application
- Select an area of your screen to capture
- The application will extract text from the selected area
- View the extracted text in a dialog window
- Choose to either copy the text to clipboard or save it to a file