[CentOS] SERIOUSLY OT STREAM EDITING IMAGES
Chris Payne
chris.payne at triumf.ca
Tue Jul 15 19:58:38 UTC 2008
On Tue, Jul 15, 2008 at 09:47:26PM +0200, Chris Geldenhuis wrote:
> I have been Googling my head off but cannot find a method to stream edit
> all the images in a directory and to resize them. I have a large number of
> images of up to 3GB in size that I want to put in albums on a website, but
> before I do this I need to resize them to a more realistic configuration.
>
> I know how to do this manually with the GIMP but it becomes tedious for
> more than a few images.
>
> Running CentOS 5 as virtualised under XEN as a web server.
I wrote a shell script to do just that, attached below. It requires a couple
of readily available command line tools from the packages:
netpbm-progs
libjpeg
And of course you can tune the scaling and quality to suit your needs.
HTH
Chris
--
Chris Payne chris.payne at triumf.ca
TRIUMF ATLAS Tier-1 System Administrator - Networking
TRIUMF +1 604 222 7554
4004 Wesbrook Mall, Vancouver, BC, V6T2A3, CANADA
#!/bin/sh
for file in $* ; do
base=`basename $file`
# change depending on your camera file extension
prefix=`echo $base | sed -e "s/\.jpg//i"`
# prefix=`echo $base | sed -e "s/\.jpeg//i"`
if [ -f $prefix.small.jpeg ] ; then
echo skippin $file
else
echo shrinkin $file
jpegtopnm $file | pnmscale .35 | cjpeg -quality 75 > $prefix.small.jpg
fi
done
More information about the CentOS
mailing list