meri (broken_gizmo) wrote,

Nifty command line tool of the day.

Originally published at You can comment here or there.

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!

Richard Rognlie liked this post
Tags: osx, technology, unix
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded