Out now: a Swift-ier version of imageprep

I’ve just released version 6.0.0 of imageprep, my macOS command line tool for processing batches of images. Born a shell script, imageprep has now not only finished school and graduated from college, but also has gained employment as a fully compiled application. It’s written in Swift so it’s quicker these days.

One of the many rarely lauded gems of macOS is sips, the self-styled “scriptable image processing system”. This is a fantastic native tool for adjusting images programmatically and doesn’t get the attention it deserves. A case in point: I use sips to scale down circular icons because it makes a much better job of it than either Pixelmator or Photoshop — no unsightly bulges at the cardinal points.

I previously used sips directly for processing images files, specifically converting their format, changing their print resolution, and cropping, scaling or padding them all to a consistent size so they could be packaged up in a PDF using pdfmaker.

Then I wrote imageprep to simplify the process by minimising the number of options that needed to be set at the command line. A shell script was the obvious way create this wrapper around sips, and in that form imageprep has served me well over the past few years.

But I got think about how I could make it run more quickly and better manage bad command-line input from me. In burst of activity I rewrote it in Swift over a couple of evenings. It still makes use of sips — no need to re-invent the wheel — but does so directly without the intervention of the shell, though that is used to call up imageprep and set up jobs.

I haven’t benchmarked it, but it’s noticeably quicker than before. And the code is more efficient and more robust.

You can read more about how imageprep is used by popping over to my website. You can download the code there too, or install it using Homebrew and my Tap:

brew tap smittytone/homebrew-smittytone && brew install --cask imageprep

The source code, as always, is available on GitHub.