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

Wolf Halton wolf.halton at gmail.com
Wed Feb 20 11:57:28 EST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130220/a96486d9/attachment.html>


More information about the Ale mailing list