How to use Fred's ImageMagick textcleaner scri

2019-06-11 11:24发布

问题:

I want to do OCR on some of my images, but images are not quite very impressive. So, for cleaning it I wanted to use Fred's ImageMagick Textcleaner script. Command that I gave:-

sh textcleaner.sh input_file output_file -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20

This is the arguments which Fred has given on website itself. I am also doing for same sample image. But I don't think so any of my options are working everything is by default. And I keep getting this error also

textcleaner.sh: line 177: type: textcleaner.sh: not found
usage: dirname path
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]

And At last I had to keep the files in same folder where my textcleaner script is. How can I make it global and give the absolute path to it rather than putting the files wherever textcleaner is.

回答1:

It's a bash script - it says so in the first line - yet you are trying to run it in sh - which is not bash. You need to make the script executable, by running

chmod +x textcleaner

then you can run it properly using:

./textcleaner ... arguments ...

That should make the error message go away. Then try showing us a sample image so we can try and see what the problem is.



回答2:

In my ImageMagick scripts, the syntax is script name ...arguments... input output. So your command should be

bash textcleaner.sh -g -e stretch -f 25 -o 20 -t 30 -u -s 1 -T -p 20 input_file output_file 


See my Pointers For Use (for further configuration) at my home page: http://www.fmwconcepts.com/imagemagick/index.php