Codecide

Blog

How to display images from the terminal

Did you know that most operating systems have the ability to display images right from the command line interface of the terminal? In fact, if you have ImageMagick installed on the host machine, you can already use the display command, like so:

display image.jpg

The display command (coupled with an existing image filename, of course) will pop a window with the image over your terminal. Hitting q or the esc key will close the modal and return you to the terminal.

That’s a good start. But if your needs go beyond the minimal functionality provided by ImageMagick — if a one-raw-image-at-a-time scenario is insufficient — you can instead use fim. You can install fim on Linux (Debian/Ubuntu) like this:

sudo apt update
sudo apt install fim

fim works just like the display command above. Additionally, the tool allows filename wildcards and will automatically load all matching images in a gallery.

fim image*

When loading multiple images, you can use pgUp and pgDn to cycle through the stack. The fim viewer displays essential information about the current image in the status bar: the filename, its original size in pixels and in bytes, the number of images in the stack and the percentage of magnification relative to the original image size. Use the + and keys to zoom in and out. There’s a lot more you can do with fim, of course.


References: 2daygeek, FIM homepage.

Leave a Reply

Your email address will not be published. Required fields are marked *