Nifty command line tool of the day.

I’m putting together a web site which needs to have a portfolio of images on it. I want to do the standard thing where you have a thumbnail, and then click for the full sized image. But creating thumbnails is a pain in the ass, so I was looking at ways to do it in bulk, or at least to script it.

Using Preview to resize images wasn’t working out too well, because it seemed to randomly miss images in a select all, and then I’d have to hunt down the individual images that didn’t get resized, and blah blah blah. Commercial options are available, but damnit, this shouldn’t need a commercial option.

Turns out, it doesn’t.

Enter ‘sips’ (simple image processing system). To create thumbnails that are 240 pixels along the longest axis, the command was ridiculously simple:

sips -Z 240 *_thumb.jpg

The one downside is that it rewrites the source files, but a bit of planning ahead, and that’s not a problem.

Huzzah for UNIX!


Comments are closed.