top | item 33712140

(no title)

lervag | 3 years ago

Cool! I've seen similar ideas before and made my own inspired by these some years ago. It's a simple bash script based on Flameshot [0] for taking the screenshot and Tesseract:

    #!/usr/bin/env bash

    rm -f /tmp/screen.png
    flameshot gui -p /tmp/screen.png

    tesseract \
      -c page_separator="" \
      -l "eng" \
      --dpi 145 \
      /tmp/screen.png /tmp/screen

    if [ "$(wc -l < /tmp/screen.txt)" -eq 0 ]; then
      notify-send "ocrmyscreen" "No text was detected!"
      exit 1
    fi

    xclip /tmp/screen.txt
    notify-send "ocrmyscreen" "$(cat /tmp/screen.txt)"
[0]: https://flameshot.org/

discuss

order

No comments yet.