====== Enhance images for OCR ====== I use this code to enhance photographs or other image files taken from black and white text. Does great job for [[wp>optical character recognition]], printing and other purposes. This script is using [[http://www.imagemagick.org|ImageMagick]] to do the actual job. #!/bin/bash mkdir "bw" for x in *.jpg ; do b=`basename $x .jpg` echo $x convert -noise 1 -unsharp 10x5+10 -threshold 20% "$x" "bw/$b.pbm"; unpaper "bw/$b.pbm" "bw/unpaper_$b.pbm" convert "bw/unpaper_$b.pbm" "bw/$b.png"; rm -f "bw/$b.pbm" "bw/unpaper_$b.pbm" done {{tag>util convert imagemagick enhance image ocr bash}} ~~LINKBACK~~