4 command-line graphics tools for Linux
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 GUI applications like GIMP.
For the most part, they’re wrong. Command-line image tools do much of what their GUI counterparts can, and they can do it just as well. Sometimes, especially when dealing with multiple image files or working on an older computer, command-line tools can do a better job.
Let’s take a look at four 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 a set of 14 single-purpose utilities that, taken 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, resize an image, and add a caption to it in a particular font.
If you find that you’re using the 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.
Most Linux distributions come with a simple graphical screen capture tool. You can also find any number of more feature-packed screen capture utilities. If your needs are simple, then turn to the command line and Scrot.
You can find Scrot in the package manager of many a Linux distribution. If it’s not available, or you want to embrace your inner geek, you can grab Scrot’s source code from GitHub and compile it yourself.
With Scrot, you can grab a shot of your entire desktop or of a particular window. You can also set a delay, allowing you to get a window into position before Scrot snaps. If you need to, you can create a thumbnail of the screen capture.
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 slideshow that you 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 the command line to, for example, display metadata from photos, create a fixed-size window, view images in full-screen mode, and hide the mouse pointer.
Most photographs contain metadata that identifies where and when those photos were taken, the model of camera used, and other information. 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 like automatic captions and an RSS feed to an album.
Do you have a favorite command-line tool for working with images? Feel free to share it by leaving a comment below.