Graphics Tricks from the Command Line
An anonymous reader writes "There's nothing quite like command-line tools for handling large batches of tasks, and image manipulations are no exception. Web developers and administrators will appreciate the ability to handle large numbers of files easily, either at the command line or in scripts. This article presents the ImageMagick suite, a Linux toolkit for sizing, rotating, converting, and otherwise manipulating images, in a huge number of formats, whether one or a hundred at a time."
I used to use it a lot back when I was doing astronomy, I used to make movies and I wrote a load of scripts for IM which basically worked on directories full of jpegs to do crossfades, motion blur, and all sorts of other effects. Some of these movies of asteroids and comets still make it onto the occasional TV slot. The originals were rendered in POV ray, but IM was more important since it was essential for editing and compositing.
It still runs today producing the map of asteroids (http://szyzyg.arm.ac.uk/~spm/), even though I've moved on a long time ago.
For a while I even used ImageMagick as the core for a webcam motion detection program - rescale, blur, edge-detect, subtract differences and then count the total intensity of the output image - it worked pretty well, although it was a little slow.
I think I've created more art with ImageMagick than I've done with the Gimp.
But the downfall of Image Magick is the installation. It is the most god awful spaghetti mess of all time when it comes to its dependancies. You see, what they don't tell you right off the bat is ImageMagick doesn't actually work with the file formats internally. AFAIK, it relies on all of the format specific libraries out there. If your application is hosted by a virtual hosting provider, good luck getting all that installed.
Once it *is* installed, however, IM rocks.
1;
I also expect some commercial image procssing software (e.g., Adobe photoshop) may export some command-line programs.
Imagemagick made me look like a miracle worker.
10,000 1.5MB bitmaps had to be delivered to the Food and Drug Administration in their original format and resolution (they needed to see things exactly as they were reviewed in a drug safety study), but wanted a visual 'menu' of the images, by patient over time.
Using the index of the images, I was able to create a labeled page-per-patient visual menu in PDF (FDA's preferred format -- but it would be a 3-character change to make it anything else). Using other tools, the same index was munged into a CSV file that was applied as hyperlinks atop the PDF menu (non-Open-Source tool, but I might have been able to find an open-source one).
In one day, the entire set of 15GB of data could be processed. In fact, putting it on a tape took longer than the image assembly.
Design for Use, not Construction!
For those of you who use python, you might want to check out the Python Imaging Library, or PIL for short.
After using many, many different tools for this type of thing (including IM, netPBM, GD, and my own tools), PIL has by far become my favorite for image processing.
Check out this simple tutorial for some examples of what you can do.
"This article presents the ImageMagick suite, a Linux toolkit for sizing..."
WTF has this got to do with Linux? AFAIK IM pre-dates any kind of wide-spread use of Linux. IM compiles on most unixes and is available for mac, win32, vms and more. It has nothing to do with Linux.
Sigh.
-----
on a web-app project i got to play with in mid-devel ... image-magick was used to convert from TIFF to GIF (i think) output. the problem was speed -- it loaded the entire image into memory in its own internal format. the problem is that the TIFF files were enormous, but they were black/white scans of documents. the final gif was also low-color, and scaled down ... but in-between, it was converting to full 24-bit color (with alpha?) and other overhead.
... MUCH MUCH FASTER.
in the end, (after we had left and done our part of the job) someone else (team lead) changed the code to a customized piece that resized the file as it streamed through, directly from TIFF to whatever output format was being used
image magick is neat -- lots of formats. but it's a lot of overhead in situations where you need speed. specialized tools (format_a2format_b) are of great help at that point.
ImageMagick is great but I always feel that the same functionality must already be present in the GIMP, and it seems rather wasteful to have to learn two different tools to do the same job.
The GIMP is scriptable with Scheme or with Perl or other languages... perhaps all it needs is a good set of command-line interfaces as well?
-- Ed Avis ed@membled.com