A Bash script that watches a directory for new screenshots, extracts text using Tesseract OCR, and copies both the text and image to the clipboard.
- Watches the
~/Pictures/Screenshotsdirectory for.pngfiles. - Extracts text from new screenshots with Tesseract.
- Copies the text to the clipboard.
- Restores the image to the clipboard after copying text.
tesseract-ocrinotify-toolsxclip
To run the script on startup in Ubuntu, there are plenty of ways to do it—but let’s be honest, my lazy a** went with this one:
-
Open the "Startup Applications" tool from the GUI.
-
Add a new entry with the following command:
/usr/bin/bash -c "sleep 15 && ~/screenshot_ocr.sh&"this works and I’m good with it.
WATCH_DIRvariable should be changed to screenshot directory.- This repo is more of a backup than anything. I might swap Tesseract for PaddleOCR or experiment with other OCR services if I ever feel like it. But for now, it’s just chilling here, doing its job.