applying Fred's scripts of several images

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

applying Fred's scripts of several images

Post by soluna »

Hi, I know this is basic, but I can't find the way to run localthresh on all the jpg files of a certain folder, i.e, I have p112.jpg, p113.jpg .... and I want to run localthresh so at the end I'll have p112-bin.gif, p113-bin-gif (it could be god or tif)
I've tried this:
$ sh localthresh -m 1 -r 15 -b 8 -n yes p*.jpg p-%d.tif
but it retrieves:
--- TOO MANY ARGUMENTS WERE PROVIDED ---

Thanks!!
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: applying Fred's scripts of several images

Post by Bonzo »

I would guess you need to write some non Imagemagickc code to loop over the images and apply the localthresh to each one in turn.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: applying Fred's scripts of several images

Post by fmw42 »

My scripts work on one input only. So you will have to write a loop over each file in a directory and process them one a time.

Code: Select all

cd yourimagedirectory
list=`ls`
i=0
for img in $list; do
name=`convert $img -format "%t" info:`
bash localthresh arguments $img ${name}_${i}.tif
i=$((i+1))
done
Depending where you have the script, you may have to put paths to the script or to the images, unless you put the path to where you have my scripts into your PATH environment variable. See my web site home page for such Pointers.

The directory with your images must not contain other types of files, but images. Otherwise, the ls line will need to filter on image types, such as

list=`ls *.jpg`

as an example.
soluna
Posts: 9
Joined: 2015-12-06T10:49:21-07:00
Authentication code: 1151

Re: applying Fred's scripts of several images

Post by soluna »

Thanks fmw42!!, I'll run in that way.
Post Reply