[Linux-Biella] OCR

leonardo buffa leonardo.buffa a bilug.linux.it
Gio 10 Mar 2011 12:42:36 CET


On Mon, 7 Mar 2011 18:09:27 +0100
leonardo buffa <leonardo.buffa a bilug.linux.it> wrote:

> ciao
> qualcuno ne ha mai usati (con soddisfazione da consigliarne qualcuno)?


se serve a qualcuno da salvare in ~/.gnome2/nautilus-scripts



[CODE]
#!/bin/sh

TMPDIR="/tmp"

for arg
do
  FILETYPE=`file $arg|awk '{print $2}'`
  FILENAME=`echo $arg|perl -pe 's/(.*)\..*$/$1/;s{^.*/}{}'`
#  zenity --info --text "Filetype: $FILETYPE"
  if [ $FILETYPE != "TIFF" ] ; then

    if [ -e $TMPDIR/$FILENAME.tif ] ; then
      zenity --question --text "File $TMPDIR/$FILENAME.tif esists,
    replace it?" REPLACE=`echo $?`
      if [ "$REPLACE" = "1" ] ; then
        exit 1
      fi
    fi
    convert -depth 8 $arg $TMPDIR/$FILENAME.tif |zenity --progress
    --pulsate --text="Not TIFF, converting" --auto-close tesseract
    "$TMPDIR/$FILENAME.tif" "$TMPDIR/$FILENAME" -l ita | zenity
    --progress --pulsate --text="OCRring, Please wait..." --auto-close
    rm $TMPDIR/$FILENAME.tif

  else
    tesseract "$arg" "$TMPDIR/$FILENAME" -l ita  | zenity --progress
  --pulsate --text="OCRring, Please wait..." --auto-close fi
  zenity --info --text "Text file: $FILENAME.txt saved in $TMPDIR"
  nautilus --browser $TMPDIR
done
[/CODE]

-- 
leonardo 'LeOS' buffa - IT security specialist
human knowledge belongs to the world
------------------------------
Linux Registered User: #135079
------------------------------


Maggiori informazioni sulla lista Linux