[ale] Bulk jpg Thumbnail production from 137000 jp2 files??

Scott Plante splante at insightsys.com
Wed Feb 20 12:15:10 EST 2013


By the way, there's no need for the `ls ...`. You can just put: 


for i in *.jp2 
do ... 

You get the same results, and you avoid creating a subshell. 
Well, you get a slightly different result when there are no *.jp2 files: ls throws an error vs i=*.jp2. 

----- Original Message -----

From: "Wolf Halton" <wolf.halton at gmail.com> 
To: "Atlanta Linux Enthusiasts" <ale at ale.org> 
Sent: Wednesday, February 20, 2013 11:57:28 AM 
Subject: Re: [ale] Bulk jpg Thumbnail production from 137000 jp2 files?? 


This is what I got to work, following Pete's lead, this time 

#!/bin/bash 

for i in `ls *.jp2` 
do 
file=`basename $i` 
#echo $file 
SUFF="jp2" 
slim=${file%.$SUFF} 
#slim=`echo $file ${file%.$SUFF}` 

#echo "$slim is the stub" 
suffix='jpg' 

convert $i -resize 7% $slim.$suffix 
echo "$slim.$suffix is created" 

done 





On Wed, Feb 20, 2013 at 10:19 AM, JD < jdp at algoloma.com > wrote: 


Here's a script that I use to make images smaller for internet publishing. 
Files cannot have spaces in their names since that is the delimiter, but ... 
just change "-opt" into "-tn" and change the convert options for your needs. 

No need to leave bash for file suffix handling. This should be much quicker. But 
there are at least 1000 different ways to skin this problem. ;) 

######################################### 
#!/bin/bash 
QUAL=30 

for img in "$@"; do 
NEW=${img/%.???/-opt.jpg} 
echo " Working on $img ..." 
convert -quality $QUAL "$img" "$NEW" 
done 
######################################### 


On 02/20/2013 10:08 AM, Wolf Halton wrote: 
> Pete: 
> That looks like it would work. 
> I will test in my sample folders. 
> I absolutely do not want to handle each file manually. :-) 
> 
> 
> On Wed, Feb 20, 2013 at 9:58 AM, Pete Hardie < pete.hardie at gmail.com 

> <mailto: pete.hardie at gmail.com >> wrote: 
> 
> shell script, not necessarily error free: 
> 
> for i in `ls *.jp2' 
> do 
> file=`basename $i` 
> suffix='suffix' 
> convert $i <options> $file.$suffix 
> done 
> 
> man basename for all the fun options - it can get you the path, a part 
> before the '.', a part after the '.', etc 
> 
> 


_______________________________________________ 
Ale mailing list 
Ale at ale.org 
http://mail.ale.org/mailman/listinfo/ale 
See JOBS, ANNOUNCE and SCHOOLS lists at 
http://mail.ale.org/mailman/listinfo 





-- 
Wolf Halton 
This Apt Has Super Cow Powers - http://sourcefreedom.com 
Open-Source Software in Libraries - http://FOSS4Lib.org 
Advancing Libraries Together - http://LYRASIS.org 
Apache Open Office Developer wolfhalton at apache.org 

_______________________________________________ 
Ale mailing list 
Ale at ale.org 
http://mail.ale.org/mailman/listinfo/ale 
See JOBS, ANNOUNCE and SCHOOLS lists at 
http://mail.ale.org/mailman/listinfo 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130220/6f314468/attachment.html>


More information about the Ale mailing list