problems using Fred's scripts

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
soluna
Posts: 9
Joined: 2015-12-06T10:49:21-07:00
Authentication code: 1151

problems using Fred's scripts

Post by soluna »

Hi,

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

--- FILE p20.jpg DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAG ZERO SIZE ---
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problems using Fred's scripts

Post 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?
soluna
Posts: 9
Joined: 2015-12-06T10:49:21-07:00
Authentication code: 1151

Re: problems using Fred's scripts

Post 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 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problems using Fred's scripts

Post 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.
Post Reply