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."
This seems like it could be useful for easy and fast (not always smart) integration into Web Applications. Its far easier to make a call to a command line image manipulation software than to call a library and do all the work yourself. Though I suppose with calling an application for the web, there may be security problems.
ImageMagick is used quite a bit with online photo galleries. Here is one of the most popular.
Best Windows Freeware
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;
Well, for starters 'xv' is not free software and you have to purchase a license for non-commercial use, while ImageMagick is distributed under a BSD style license...
Do you have some code to change now?
I also expect some commercial image procssing software (e.g., Adobe photoshop) may export some command-line programs.
ImageMagick has all conversion type stuff in one "convert" program, so you don't have to pipe stuff between fifteen programs to get things done.
OTOH, ImageMagick loads the entire file into memory to do its work, so on really big files you are better off shipping it through the pipe. (I've got a 150MB JPG around here that chokes convert, but pipes through netpbm great.)
I like to have both on my machine.
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!
...and, of course, FreeBSD has it in the ports tree. You would be amazed at the number of graphics (and other) ports that pull in the latest version of ImageMagick as a dependancy.
Mind you, NetPBM isn't under-represented, either.
|>
Here be Dragons
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.
And of course, Windows. I wrote some stuff for a photographer with Perl,Tk, and ImageMagick, and it works fine on her W98 machine. Well, I would prefer something nicer than Tk, but it seemed like that was the best choice for cross platform with Perl.
"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.
convert -adjoin photos*.jpg one_big.pdf
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