Skip to content

Instantly share code, notes, and snippets.

@neckhair
Created April 30, 2016 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neckhair/5973b0825b6f815655bc326b8ee09875 to your computer and use it in GitHub Desktop.
Save neckhair/5973b0825b6f815655bc326b8ee09875 to your computer and use it in GitHub Desktop.
#!/bin/bash
filename=$(basename "$1")
extension="${filename##*.}"
filename="${filename%.*}"
tempfile=/tmp/$filename-gray.jpg
convert $1 -colorspace gray -auto-level -threshold 50% $tempfile
convert -density 150 -quality 20 -resize 50% -compress lzw $tempfile $tempfile
tesseract -l deu $tempfile $filename pdf
rm $tempfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment