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

JD jdp at algoloma.com
Wed Feb 20 10:19:36 EST 2013


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
> 
> 


More information about the Ale mailing list