Fast OCR to clipboard
source link: https://willbush.netlify.app/blog/fast-ocr-to-clipboard/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Fast OCR to clipboard
Just give me the text
I wanted to share a surprisingly elegant solution I found to copying text into the clipboard where for one reason or another it's otherwise not possible.
flameshot gui --raw | \
tesseract stdin stdout | \
xclip -in -selection clipboard
- flameshot :: Powerful yet simple to use screenshot software
- tesseract :: Tesseract Open Source OCR Engine
- xclip :: Command line interface to the X11 clipboard
I didn't come up with this incantation, rather found it after a lot of searching for a tool that solves this problem.
The flameshot gui
launches a GUI that allows you to select a region of the screen, and then press enter. The image output is piped to tesseract
which does the OCR and in turn pipes it to xclip
which copies it to the clipboard.
I think this is the first time I've seen a GUI tool that follows the Unix Philosophy.
I personally alias this to ft
in my NixOS (btw) config like so.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK