Digital camera's are being increasingly used to capture moments, screen shots, evidential photographs and other artifacts, the challenge has been the progressively large size of the JPG image files.
A large JPG image file of 3MB, 5MB, 7MB or even 15 MB has a lot of bits, that are useful for digital processing and commercial art. However, images of 640x480, 1024x768 pixel resolution are useful for consumption on the web eg. photogallery, blogs, articles etc.
'convert' is a versatile utility that is part of the ImageMagick toolkit and is available on FreeBSD, NetBSD, OpenSolaris and Linux, perhaps even on Windows.
Let us say, you have a directory full of image files with .JPG extension, that you have just moved/downloaded across from your digital camera.
Here is a sample script that does the job of reducing the size of .JPG files and renames them to filename.jpg (all lower case)
for jpgname in *.JPG;
do
filename=`basename -s .JPG ${jpgname}`;
convert -verbose -resize 640x480 +profile '*' ${jpgname} ${filename}.jpg;
done
You'd see an output like this
P1070895.JPG JPEG 2048x1536 2048x1536+0+0 8-bit DirectClass 1.231MB 0.560u 0:00.570
P1070895.jpg JPEG 2048x1536=>640x480 640x480+0+0 8-bit DirectClass 147KB 2.740u 0:01.589
P1070896.JPG JPEG 2048x1536 2048x1536+0+0 8-bit DirectClass 1.442MB 0.590u 0:00.589
P1070896.jpg JPEG 2048x1536=>640x480 640x480+0+0 8-bit DirectClass 184KB 2.780u 0:01.620
P1070897.JPG JPEG 2048x1536 2048x1536+0+0 8-bit DirectClass 1.31MB 0.570u 0:00.580
P1070897.jpg JPEG 2048x1536=>640x480 640x480+0+0 8-bit DirectClass 147KB 2.770u 0:01.620
P1070898.JPG JPEG 2048x1536 2048x1536+0+0 8-bit DirectClass 1.592MB 0.600u 0:00.599
P1070898.jpg JPEG 2048x1536=>640x480 640x480+0+0 8-bit DirectClass 197KB 2.750u 0:01.610
You're now all set to use the web ready jpg files.
the convert utility has many options, eg. reduce the size of the image by certain percentage, convert .JPG file to .PNG format etc. Please take a look at various command line options at http://www.imagemagick.org/script/command-line-options.php