Page 1 of 1

applying Fred's scripts of several images

Posted: 2015-12-12T07:28:21-07:00
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!!

Re: applying Fred's scripts of several images

Posted: 2015-12-12T07:32:25-07:00
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.

Re: applying Fred's scripts of several images

Posted: 2015-12-12T11:33:44-07:00
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.

Re: applying Fred's scripts of several images

Posted: 2015-12-13T14:30:56-07:00
by soluna
Thanks fmw42!!, I'll run in that way.