Hacker News new | ask | show | jobs
by tmerse 1298 days ago
Nice! Didn't know about maim. This looks better than what I currently use (found it somewhere on the internet).

  #!/bin/bash
  SRC_IMG=$(mktemp -u /tmp/ocr_XXXXXXXXX.png)
  scrot --select "$SRC_IMG" -q 100
  mogrify -modulate 100,0 -resize 400% "$SRC_IMG"
  tesseract "$SRC_IMG" "$SRC_IMG" &> /dev/null
  OCR_RESULT=$(cat "$SRC_IMG.txt")
  echo "$OCR_RESULT"
  notify-send "$OCR_RESULT"
  xsel -bi < "$SRC_IMG.txt"
1 comments

I mean don't scrot and maim do the same? It can write to stdout as well. Is the resize really worth it?
Tesseract get's significanlty better results after resize; can probably get away with a 2x resize on a 4k monitor, but 4x is good for e.g. 1200p