Thursday, February 4, 2010

Image-Processing Utilities





Image-Processing Utilities



The
GIMP



Beyond a doubt, the best image-processing
program available for Linux is called the GIMP, or GNU Image Manipulation
Program. It is released under the GNU General Public License, so source code is
available, and it is built to allow easy integration of third-party extensions.
It is often compared to Adobe's Photoshop in the breadth of its features. Like
Photoshop, the GIMP also has a considerable learning curve, but the time
investment is well worth it if you need to process images on a regular basis. The
GIMP has been in development for many years now, and plentiful reference guides
and tutorials are available on the Web. There is even a site oriented toward
artists, rather than techies, who would like to investigate the creative
possibilities of this package and other Linux-based image-processing tools.



ImageMagick



For command line image processing, one of the
best tools is ImageMagick. It is provided as a shared library and a set of
binaries, and supports even more image formats than the GIMP (if that's
possible!). The commands can be combined with shell or another scripting
language to perform batch processing on large numbers of images.



The convert
command can be used to convert between image formats, scale, crop, rotate, or
merge images, add borders to an image, adjust brightness and contrast, and
perform many other operations. Not surprisingly, you can check the man page to
get an idea of all the available options. ImageMagick also includes commands to
display images to the screen (display), create
photo montages (montage), and create animations
(animate; can you see a pattern in the command
names?).



The general form of the class=docemphasis1>convert command is:



convert [options] input-file output-file


As a simple example, suppose you have a number of BMP images
that were scanned from a set of photos. The sizes of the images vary, and the
brightness and contrast vary moderately from photo to photo. The following
command line will convert all the photos to approximately 250 x 250 pixels
while preserving aspect ratio, adjusting the brightness, and adding a 10-pixel
white border:



for file in *.bmp; do
������� convert -border 10x10 -bordercolor #FFFFFF -equalize -geometry 250 \
��������������� $file 'echo $file | sed 's/bmp/jpg/'';
done


What's aspect ratio? Simply
put, it's the ratio of width to height. If we didn't preserve this value, the
image would look squashed horizontally or vertically, and we don't want that.



As usual, a Linux software environment shines at automating a
task that could potentially be highly repetitive. Try retouching 50 images
using a traditional application; each image might take 10 or 15 mouse clicks.
That would definitely not be a well-spent hour, and that estimate assumes
you're highly proficient with a mouse! In this situation, a command line
solution is far quicker.



 





0 comments:

Post a Comment