Hi Fred,

Awesome, yeah I was gonna say that it could be heavily optimised :-) thanks
for your time and hard work, I appreciate it. Don't forget to join our site,
we're just releasing it tonight!

Dave

On Feb 17, 2008 9:02 PM, Fred Weinhaus <[EMAIL PROTECTED]> wrote:

> Dave,
>
> Here is a simpler version that keeps all the calculations within IM
>
> #!/bin/bash
>
> infile="your_infile"
> outfile="your_outfile"
>
> dwidth=180      # desired thumbnail width
> dheight=130     #desired thumbnail height
>
> test1=`convert $infile -format
> "%[fx:((w/h)>(${dwidth}/${dheight})?1:0)]" info:`
> test2=`convert $infile -format "%[fx:((w/h)>=1?1:0)]" info:`
>
> if [ $test1 -eq 1 ]
>        then
>        echo "aspect larger than desired aspect (wider than tall)"
>        resize="${dheight}x${dheight}^"
> elif [ $test2 -eq 1 ]
>        then
>        echo "aspect less than desired aspect (wider than tall) but
> greater than or equal to 1"
>        resize="${dwidth}x${dwidth}"
> else
>        echo "aspect less than 1 (taller than wide)"
>        resize="${dwidth}x${dwidth}^"
> fi
>
> convert $infile +repage -resize $resize \
>        -gravity Center -crop ${dwidth}x${dheight}+0+0 +repage $outfile
> identify -format "%w x %h" $outfile
>
>
> Fred
>



-- 
David Di Biase
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to