Fast OCR to clipboard

Open link in next tab

Fast OCR to clipboard

https://willbush.dev/blog/fast-ocr-to-clipboard/

<h1 id="just-give-me-the-text">Just give me the text</h1> <p>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.</p> <pre data-lang="bash" style="background-color:#2e3440;color:#d8dee9;" class="language-bash "><code class="language-bash" data-lang="bash"><span style="color:#88c0d0;">flameshot</span><span> gui --raw </span><span style="color:#81a1c1;">\ </span><span> </span><span style="color:#81a1c1;">| </span><span style="color:#88c0d0;">tesseract</span><span> stdin stdout -l eng </span><span style="color:#81a1c1;">\ </span><span> </span><span style="color:#81a1c1;">| </span><span style="color:#88c0d0;">xclip</span><span> -in -selection clipboard </span></code></pre>

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.

Sign in to add comment

This is gorgeous, I've used flame shot for years, and constantly use xclip, never once thought about sticking OCR in the middle.

Awesome stuff.

Thanks for this!!

I just realized I can use the following command to OCR a bitmap in the clipboard and put the text back into the clipboard.

xclip -out -selection clipboard -t image/bmp
| tesseract stdin stdout -l eng
| xclip -in -selection clipboard

This works in my linux VM (in Virtualbox on my work laptop) using bi-directional shared clipboard without touching my Windows software.

Mind blown!!

Holler holler get doller. Thank you very much. Now I just need a way to use a custom image host.