csImageResizer

I needed to take very large jpegs and resize them to much more reasonable dimensions and I needed to do this on the command-line. AppleScripting Photoshop or Graphic Converter seemed like overkill and GD didn’t seem to like MacOS 10.4.5.

CoreImage, part of the Core Services Apple has been including in OS X for a while now, does have some image scaling capacity and while it’s not the most intuitive API, it works like a charm.

One thing to note about this application, though, is that it only handles jpegs right now. While there are utilities to handle PNGs, I wasn’t able to get CGBitmapContextCreate to deal with the aspects of a PNG correctly. There are hooks, though, to look for PNGs. So if you’re so inclined, go ahead and add in PNG support.

Download
(Both source code and application are bundled together)
csImageResizer v1.00 is available here

Requirements

  • Mac OS 10.4.0 or higher

Installation

  1. Download and mount the disk image
  2. Copy csImageResizer to your home directory
  3. Open the Terminal app and run: ./csImageResizer -h

Support
Chances are that I've got a bug or two in this guy. I can't test every possible environment, so if you have problems, questions, or requests, shoot an email to If you happen to add in support for PNGs or GIFs, I'd be delighted in seeing how you did it.