Page 1 of 1

problems using Fred's scripts

Posted: 2015-12-07T10:02:14-07:00
by soluna

I need to binarize several images, I've been trying with Fred's scripts, but I can't make it work, please help!! Thanks community

$ sh ~/ImageMagick-scripts/otsuthresh p20.jpg p20_out.jpg
/Users/myname/ImageMagick-scripts/otsuthresh: line 94: type: /Users/myname/ImageMagick-scripts/otsuthresh: not found
usage: dirname path
usage: basename string [suffix]
basename [-a] [-s suffix] string [...]
/Users/myname/ImageMagick-scripts/otsuthresh: line 182: convert: command not found
/Users/myname/ImageMagick-scripts/otsuthresh: line 192: convert: command not found
/Users/myname/ImageMagick-scripts/otsuthresh: line 204: [: : integer expression expected
/Users/myname/ImageMagick-scripts/otsuthresh: line 210: [: : integer expression expected
/Users/myname/ImageMagick-scripts/otsuthresh: line 215: convert: command not found


Re: problems using Fred's scripts

Posted: 2015-12-07T11:22:13-07:00
by fmw42
What is your IM version and platform? Did you follow all my Pointers about setting up the script including putting the path to where you keep my scripts into your PATH environment variable via export in the .profile file?

It is not finding the script to report dirname and basename. It also looks like the script cannot find convert. Please review the Pointers on my web site home page.

Are you running this is a bash window?

Re: problems using Fred's scripts

Posted: 2015-12-08T04:14:06-07:00
by soluna
Many thanks for your replay. I'm working with the latest version if IM and OSx Yosemite 10.10.5:
$ /opt/local/bin/convert -version
Version: ImageMagick 6.9.2-4 Q16 x86_64 2015-12-07
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
Features: Cipher DPC Modules
Delegates (built-in): bzlib djvu fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms ltdl lzma openexr png ps tiff webp x xml zlib

I think that the problem is with the PATH, I'll go to revise your pointers though I'm new in this command-line world and sometimes it is difficult to follow the instructions. As far as I can see IM is properly installed in /opt/local/bin/, but for some reason it is not correctly set in the path. Also, I don't know if the images to be treated should be placed in the same folder of the scripts or the same folder of IM, or they can be in a separate folder.

Thanks again, let's see if I can find the solution in your web.

Re: problems using Fred's scripts

Posted: 2015-12-08T11:13:50-07:00
by fmw42
see viewtopic.php?f=1&t=28781#p128075

If the PATH is setup properly, you can run convert from any directory. But you will need to provide the full path to the input and output if the images are not in the same directory from where you call convert.