Open Source Musings The thoughts, ideas, and opinions of an open source guy

3 command line tools for working with graphics

A blurry photo of a command lne session

Photo credit: *n3wjack's world in pixels via Visualhunt / CC BY-SA

(Note: This post was originally published, in a slightly different form, at It appears here via a CC-BY-SA 4.0 license.)

Images and the command line. They seem an unlikely pair, don’t they? There are people who’ll tell you that the only way you can manipulate and view graphics is with software like The GIMP or any number of other GUI application.

For the most part, they’re wrong. Command line image tools can much of what their GUI counterparts can and they can do it just as well. Sometimes, especially when dealing with multiple image files or when you’re working on an older computer, command line tools can do a better job.

Let’s take a look at three command line tools that can ably handle many of your basic (and not-so-basic) image manipulation tasks.


GraphicsMagick isn’t a single application. It’s set of 14 single-purpose utilities that, taken togehter together, are like a multitool for manipulating graphics at the command line. GraphicsMagick includes tools that let you convert, resize, compare, animate, and view images. And it does a lot more.

GraphicsMagick supports over 88 image formats, and gives you a considerable amount of control over how you can manipulate images in those formats. You can, for example, tell GraphicsMagick to convert an image from TIFF to JPEG, to resize an image, and add a caption to it in a particular font.

If you find that you’re same set of commands over and over again, you can combine the GraphicsMagick batch utility with a shell script to run those commands in one fell swoop. That cuts down on the number of keystrokes.


Feh is a simple tool for viewing one or more images from the command line. Those images don’t display in the terminal. Instead, they pop up in a very basic graphical window on your desktop.

All you need to do to use Feh is navigate to a directory and start the application. Feh creates a slide show can move through by pressing the left and right arrow keys on your keyboard. Nothing complex, nothing pretty, but it works.

Feh has a number of options you can add at command line to, for example, display metadata from photos, create a fixed-size window, view images in full-screen mode, and to hide the mouse pointer.


Most photographs contain metadata which identifies where and when those photos were taken, the model of camera used, and other information about the image. Sometimes that metadata might not be correct or you might want to scrub it from your photos. That’s where Exiv2 comes in.

Exiv2 can easily add, delete, extract, print, and modify a photo’s metadata. Exiv2 supports two dozen image formats, and has a large number of options. You probably won’t use a fraction of those options, but you never know when they’ll come in handy

This isn’t a tool for the casual photographer. If, however, you need to manipulate the metadata in one or more of your photos, Exiv2 is more than up to the task.

Two other tools worth looking at

Video files can be huge. If you have a short clip, embedding the video in a web page can be a bit overkill. Why not use an animated GIF instead? Gifify does just that, allowing you to resize a video, compress the resulting image, an even add text or subtitles to the image.

Album takes a directory of images and generates a set of thumbnails and an HTML page which become an online photo album. The tool has a number of themes you can add to the HTML page and supports several plugins that add features to the finished album like automatic captions and an RSS feed.

Thoughts? Let's start a conversation on Twitter.

Did you enjoy this post or find it useful? Then please consider supporting this blog with a micropayment via Liberapay. Thanks!