Better HN
topnewbestaskshowjobs
Log inSign up

dobicinaitis

1 karma · joined Jan 3, 2021 (5y ago) · 1 submissions

Submissions

comment 2y ago · link · parent

Another variant of the scripts floating around that I've been using to scratch the same itch:

  #!/bin/bash
  # Performs Optical Character Recognition (OCR) on a freely chosen
  # screen area and copies the recognized text to the clipboard.
  #
  # Dependencies: sudo apt install gnome-screenshot tesseract-ocr xclip
  
  IMAGE_FILE="/tmp/ocr.png"
  
  gnome-screenshot --area --file "$IMAGE_FILE"
  tesseract "$IMAGE_FILE" - | xclip -rmlastnl -selection clipboard
  
  rm -f "$IMAGE_FILE"