Image processing en-masse…

From time to time, I recieve a CD-ROM filled with images from one client or another with the idea that I can just slap them up on the web.  Sometimes it is just that simple, and I love the clients who make it so.  But sometimes a little more work is needed.  One client I work with frequently has an extensive background in print marketing, and routinely sends me disks full of TIFF images.  It’s times like this when knowing the tool for the job can save you hours of work.

Today’s tool of choice is ImageMagick, the Swiss-Army-Knife of image processing tools.  If you have never used this tool, I recommend you download it and get familiar with it.  It makes short work of alot of the heavy lift tasks associated with ensuring that images are web-ready.  It is a simple one-liner for me to convert the directory of TIFF files to web ready jpegs:

mogrify -format jpg -path _forUpload *.tif

It takes all the *.tif files and converts them to jpg format, and outputs them into the given sub-directory (_forUpload), retaining the base filenames.  If I need to resize them to a maximum of 1280 pixels in width while retaining the aspect ratio, it’s just about the same:

mogrify -format jpg -path _forUpload -resize 1280 *.tif

Many more examples of how to use the various command line utilites to do anything from simple format changes to filtering and serious editing can be found on the website.

It’s a tool I’ve used in the past but, for some reason, since forgotten about.  Starting work this morning with the task of converting a couple of hundred files for upload to a client’s site sent me running to look for tools,  (I could have written a script to do it in Photoshop I guess), and seeing ImageMagick pop up in the google search was just one of those “Duh! I’m a moron!” moments.  I was happy to see the Windows version for x64 architecture as well, the install was about as simple as it gets, and within minutes I was happily crunching images.

I reccomend that all serious web workers keep this one in their toolbox.

Now if I could just find a tool to extract images and text from a folder full of PDF documents…any suggestions out there?

Leave a Reply

Musings From the World of PHP