4 command-line Linux tools for working with images

4 command-line graphics tools for Linux

4 command-line graphics tools for Linux
Image by : 

opensource.com

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

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.

Scrot

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

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.

Exiv2

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.

13 Comments

Scofflan

Pdftk is a great command for managing PDFs ( not strictly images ). It supports working with form fillable data and many other very handy features.

Vote up!
1
Vote down!
0
rishianand

ImageMagik

Vote up!
0
Vote down!
0
ScottNesbitt

I was going to include ImageMagick (which I've used for years) in this article, but while writing someone reintroduced me to GraphicsMagick and it got the nod.

Vote up!
0
Vote down!
0
libreman
Vote up!
1
Vote down!
0
PatDavid

Also, G'MIC (http://gmic.eu), which also runs as a very popular GIMP plugin but has full command line usage available too.

Vote up!
1
Vote down!
0
Oscar

To convert images XnConvert: http://www.xnview.com/ In the same web, you can check XnView and XnView MP

Vote up!
0
Vote down!
-1
Oscar

And nconvert for command line. I think that xnconvert can generate the command line for nconvert, in case you want to repeat the process without using the GUI

Vote up!
0
Vote down!
-1
Sven

Hello,

the most commonly used snapshot program is "xwd". It is a standard part of X11 and will have been installed with most desktops.

A popular tool is ffmpeg. It is a video tool, but it can handle pictures just the same. It can convert picture sequences into video, it can extract pictures out of videos or turn a video into a sequence of separate pictures. Link: https://ffmpeg.org/

Hugin is the name of a panorama picture stitcher, meaning, it can combine pictures of the same scene into one while aligning them perfectly and can also take care of geometry and colour differences. Link: http://hugin.sourceforge.net/

A similar tool to Hugin is Enblend/Enfuse and it can be used to combine multiple pictures into HDR pictures. One can use it to take multiple pictures of the same scene and combine these to reduce image noise and to correct light dynamics. Link: http://enblend.sourceforge.net/

These are all open source tools that are used on the command-line.

Vote up!
1
Vote down!
0
tomi

if one has imagemagick/graphicsmagick, [gm] import can be used in place of scrot.

e.g.

gm import ( -frame -screen | -screen | -window root ) output-file.png

Vote up!
0
Vote down!
0
RaveYoda

Scrot is awesome. I just got into it with you mentioning this article.

Vote up!
1
Vote down!
0
Jason N.

If you extend the limit of what would be installed in a CLI a small bit and what's graphical, phantomjs to run a browser in a CLI, including screenshotting, deserves a mention.

Vote up!
0
Vote down!
0
Siegfried Schnieders

For taking screenshots I usually use "xwd | convert - out.jpg".

Vote up!
0
Vote down!
0
Tinu

The tools in libjpeg-progs are very good and perform "looseless" operations(rotation for example) , all the tools mention in the article are not; for image scaling imagemagick has a lot of great options( I assume that graphicmagick does the same thing but I don't use it).

Vote up!
0
Vote down!
0