Tag Archives: imagemagick

Useful gems, 2020 edition

Since the gem ecosystem keeps changing, and since I don’t write new programs very often, here’s a list of my favorite gems for developing command-line interface tools.

Option parsing gem: slop. (Since micro-optparse looks moribund; see here.) But (looking at programs I’ve written) I also seem to like trollop, a/k/a optimist. But I also like the fine-grained control of OptionParser.

Debugging output (not the same as logging): pastel

Invoking system functions gem: tty-command. (See also tty-config and tty-file.) But sadly, tty-command (or how I’ve used it) gets me warnings that bellyache about the 2.7 named argument splat problem.

Wrapper for ImageMagick: About a decade ago, I couldn’t get RMagick (rubymagick?) to compile and I’ve never gotten around to checking back. For awhile I used %x<convert ...> or whatever, but now, if I’m working with images, I’ve sometimes found mini-magick helpful.

Proper Capitalization of Text Strings That Are Titles: titleize.

Parsing Biblical references (e.g., Romans 8:39 and Genesis 12:1-4): pericope.

Plus Kramdown and HAML and SASS (which is no longer written in Ruby).

Mini Magick

I just discovered MiniMagick. It is exactly what I was looking for in a ruby-language wrapper for ImageMagick.

I’ve been using ImageMagick forever. Like, more than 20 years foreer. Maybe 30 years;  I don’t know when it was first developed, or how old it was when I discovered it.

Some of the time, I use ImageMagick from the command line: just convert a file or montage a couple of them, or whatever. But sometimes, I do the same three things to an image and expect to do it over and over again for multiple images, I’ll write a shell script.

Writing shell scripts is hard. (Like, do you use trap? Of course you don’t.)

Writing Ruby is easy. But the only Ruby wrapper for ImageMagick I knew about was RMagick, which is big and complex and the first couple of times I tried to use it I had build problems (this was back before gems and github).

So there I was. Use bash and keep it simple, or use ruby with some crazy backtick `convert foo.png foo.jpg` shell escape there instead of doing it right.

But MiniMagick is just a well-designed wrapper around those backticks. Kudos!

Photo Manipulation Tools

Here are some of my favorite tools for working with digital images.

Pixelmator. This is my go-to program for digital images, and someday they’ll ship 2.0 and it will be awesome.

Xee calls itself “a lightweight, fast and convenient image viewer and browser.” I agree. The best feature, for my money, is that it lets you losslessly rotate and crop JPEG images. You can do that with jpegtran too, but that’s a command-line tool. Those are great for batch jobs, but image cropping is almost always better done using an interactive GUI front-end.

Acorn is my second-favorite image editor. If Pixelmator wasn’t so darned good, this would be my favorite. Usually what brings me to Acorn is when I need to do something with filters and I can’t figure out how to do it in Pixelmator. The tech support is great, too.

Speaking of filters, I like to goof around with FX Photo Studio, too. MacPhun, the maker, also makes a cute one-trick-pony called Color Splash Studio which is worth the $2 I paid for it.

I also use a ton of different command line tools. I’ll write about those someday Real Soon Now.