<div dir="ltr">This is what I got to work, following Pete's lead, this time<br><br>#!/bin/bash<br><br>for i in `ls *.jp2`<br>do<br> file=`basename $i`<br> #echo $file<br> SUFF="jp2"<br> slim=${file%.$SUFF}<br>
#slim=`echo $file ${file%.$SUFF}`<br> <br> #echo "$slim is the stub"<br> suffix='jpg'<br> <br> convert $i -resize 7% $slim.$suffix<br> echo "$slim.$suffix is created"<br>
<br>done<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 20, 2013 at 10:19 AM, JD <span dir="ltr"><<a href="mailto:jdp@algoloma.com" target="_blank">jdp@algoloma.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here's a script that I use to make images smaller for internet publishing.<br>
Files cannot have spaces in their names since that is the delimiter, but ...<br>
just change "-opt" into "-tn" and change the convert options for your needs.<br>
<br>
No need to leave bash for file suffix handling. This should be much quicker. But<br>
there are at least 1000 different ways to skin this problem. ;)<br>
<br>
#########################################<br>
#!/bin/bash<br>
QUAL=30<br>
<br>
for img in "$@"; do<br>
NEW=${img/%.???/-opt.jpg}<br>
echo " Working on $img ..."<br>
convert -quality $QUAL "$img" "$NEW"<br>
done<br>
#########################################<br>
<div class="im HOEnZb"><br>
On 02/20/2013 10:08 AM, Wolf Halton wrote:<br>
> Pete:<br>
> That looks like it would work.<br>
> I will test in my sample folders.<br>
> I absolutely do not want to handle each file manually. :-)<br>
><br>
><br>
> On Wed, Feb 20, 2013 at 9:58 AM, Pete Hardie <<a href="mailto:pete.hardie@gmail.com">pete.hardie@gmail.com</a><br>
</div><div class="im HOEnZb">> <mailto:<a href="mailto:pete.hardie@gmail.com">pete.hardie@gmail.com</a>>> wrote:<br>
><br>
> shell script, not necessarily error free:<br>
><br>
> for i in `ls *.jp2'<br>
> do<br>
> file=`basename $i`<br>
> suffix='suffix'<br>
> convert $i <options> $file.$suffix<br>
> done<br>
><br>
> man basename for all the fun options - it can get you the path, a part<br>
> before the '.', a part after the '.', etc<br>
><br>
><br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Wolf Halton<br>This Apt Has Super Cow Powers - <a href="http://sourcefreedom.com" target="_blank">http://sourcefreedom.com</a><br>Open-Source Software in Libraries - <a href="http://FOSS4Lib.org" target="_blank">http://FOSS4Lib.org</a><br>
Advancing Libraries Together - <a href="http://LYRASIS.org" target="_blank">http://LYRASIS.org</a><br>Apache Open Office Developer <a href="mailto:wolfhalton@apache.org" target="_blank">wolfhalton@apache.org</a><br>
</div>