ImageMagick

By Deane Barker on June 18, 2004

ImageMagick – Convert, Edit, and Compose Images: I just want to give a little recognition to ImageMagick, which is a free image manipulation library that’s been around for years. I downloaded a new version the other day, and I’m so impressed at what it can do.

ImageMagickTM 6.0.2 is a robust collection of tools and libraries to read, write, and manipulate an image in many image formats (over 89 major formats) including popular formats like TIFF, JPEG, PNG, PDF, PhotoCD, and GIF.

I’m using this version on a Windows server via PHP. It has an installer, comes with a little image viewer and all sorts of other goodies, and just works beautifully in general.

ImageMagick has fantastic API support (though no Windows COM API, curiously), and there’s some great documentation out there. In particular, this page over at IBM’s site will give you a great start on what it can do, and this page takes it a bit further.

Using ImageMagick, I built a little system whereby I can dynamically resize an image by calling it with a certain URL pattern. Say I have a 600-pixel image that I need at 200-pixels for a certain page. I just embed the image in HTML like this:

Using an Apache AliasMatch directive, that request is intercepted by a PHP page which opens the image, resizes it, then serves it up at the requested size with correct MIME type. It’s like I have the image pre-sized at an infinite number of dimensions.

There are some efficiency concerns here as image resizing isn’t cheap in terms of CPU cycles, but this is for a business intranet with a finite number of users and loads of extra CPU capacity. If I was doing this on the Internet, I’d at least cache the resized result for future requests.

ImageMagick is a perfect example of the success of open-source software — amazing utility, expansive community, and no restrictions.

Gadgetopia

Comments

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.