ImageMagick IS (Magic)

The more I look at what I’m been doing over the past year in terms of educating myself (probably my biggest hobby, and I do not mean that facetiously), the more I see myself – in the computer arena – drifting from learning new languages and such to learning/creating more tools.

By tools, I mean code or applications (such as Erwin) that helps take the drudgery – and time-consuming efforts – out of basic operations and leave one with more time to do the fun/learning stuff.

An example of a tool would be installation (and training) of a spam filter. I finally found one I liked for Outlook (yes, I’m asking for it…) and installed it.

  • Before: Getting 100-200 spams a day, deleting one by one (with big batches at once after breaks/sleep)
  • After: Browse the list of spams once or so a day, delete all. (I’ve only gotten one false positive so far! Amazing! [SpamBayes]

Same task – check spam – but now so much quicker.

Other Lee’s-True-Life-Examples:

  • Regular Expressions: I’ve used them before – beginning in Perl – but now I’m getting both better at them and learning the nuances of using them in PHP and ColdFusion. A long time ago (not!), I wrote the cruftiest e-mail address validator imaginable, with loops and so on; I’ve now compressed it to a single regex. That’s progress!
  • Scripts/Automation: Using Windoze batch files, SQL Server Scheduler and shell scripts (bash) on Linux, I now move around a hell of a lot of data every day. I not only do backups with these tools, but I post to my Web sites with database/content updates at periodic intervals. So, I can work locally and stuff just happens as I wish. Sure, took time to set up and code: But now it’s done; outside of an occasional check to make sure stuff is happening as I wished, no more time wasted (for example) exporting a SQL Server script that joins several tables to a flat file that is then FTP’d to one of my Web sites. It happens automagically.
  • Parsers: While parsers are usually a one-off affair (you write one for a specific, unique use), once written, it’s done! Just run when you need update, or set a crontab entry and you don’t even have to do that. And while parsers are basically unique, once you write a few, they get pretty similar in flavor (grab this file[s], extract such-and-such info, push this data to that). Another tool in the scabbard

Over the past week or so, I’ve finally (finally!) dug into the image-processing tool, ImageMagick.

I first ran across ImageMagic at cars.com; it was used there to batch-process vehicle images from vendors. I ran into some problem there, I cannot even remember what, and looking at the command line help (Solaris), I grabbed and e-mail address … and the woman there wrote back before the end of the day. Try that with Adobe!

I ran across it several other times over the year, but never installed it on a home machine and actually messed with it.

As mentioned above, that’s changed.

And ImageMagick is magic.

What a great tool.

I ran across an article about ImageMagick on the IBM site; it finally piqued my interest enough to download and play with.

A week later, I’m still playing with it.

I installed in on my Linux box, and – after some gnashing of teeth (hint: the php.ini file comes with “file uploads = no” by default) – got it working, and working well.

While ImageMagick is a command-line tool (which is what appeals to me – I like Adobe’s ImageReady with its droplet tool, but I like the command line), I integrated it into a PHP page so I could use it to easily batch process images.

A simple example?

Here’s a large image (scanned in from a slide) that is reduced – in the one upload – to a small (thumbnail) and full-sized image:

Full-size image:
Thumbnail image:

Hey, that’s good stuff. One upload, and the backend processes resize to my specs and puts them in the correct folders. The next step, of course, are various error-trapping mechanisms and so on, but – once I get this going here – it will make my life so much easier.

I’ll wonder how I got by without it.

Again, tools…