in reply to Re: thumbnails generator
in thread thumbnails generator
Now there is a good reason to do it in Perl! I don't think it would be much slower than a script, but that might be worth testing.
#!/bin/bash shopt -s nullglob for image in *.{gif,bmp,jpg,wmf,jpeg,png} do printf "Converting $image\n" bits=(`/usr/bin/identify -format "%h %w" "$image"`) if [ ${bits[0]} -gt ${bits[1]} ] then sizes=(600x800 81x108) else sizes=(800x600 108x81) fi ext=${image##*.} /usr/bin/convert -resize ${sizes[0]}! "$image" "${image/.$ext/-l.$ +ext}" /usr/bin/convert -resize ${sizes[1]}! "$image" "${image/.$ext/-s.$ +ext}" done
Update: Fixed a few subtle problems in the script that surfaced with more extensive testing (not that anybody will care, this not being Perl - but I do. :)
-- Human history becomes more and more a race between education and catastrophe. -- HG Wells
|
---|