There are various GUI-based applications in Linux distributions to view images, but many Linux users prefer to work with the terminal. This guide is going to mention few techniques to display images in the terminal. These methods would be quite helpful for those who are searching for CLI (Command Line Interface) based applications to view images. So, let’s begin:
How to display images in terminal through FIM
The first method to view pictures in the terminal is FIM, an open-source, highly customizable image viewer application. FIM represents Fbi IMproved, and Fbi is “frame buffer image viewer” in Linux. FIM is lightweight compared to many GUI-based applications and comes with various shortcut keys to control images. Common file formats FIM supports are jpeg, png, gif, ppm, tiff, and xwd. To install it, use the commands mentioned below:
For Ubuntu and Debian based distros, FIM can be installed using:
The syntax to display image in terminal is:
Now, to display the image in the terminal, use:
To display all the images of the same extension, use:
The keyboard shortcuts to control image are listed below:
- Image Navigation : PageUp & PageDown or “Enter”
- Zoom : +\-
- Autoscale: a
- Fitting width and height: w\h
- Flip: f
- Mirror: m
- Rotate (clockwise) : r
- Rotate (anti-clockwise) : R
- To quit FIM, press the “Esc” or “q” key.
How to display images in terminal using ImageMagick
Most Linux users are aware of the “ImageMagic” utility. It is a lightweight application to manipulate images of hundreds of formats, including jpeg, png, gif, pdf, svg, etc. It can even convert the images from one format to another.
But many of us don’t know that there is a command associated with this app called the “display” command. Using the “display” command, you can view the image in the terminal. To install it, use the below-mentioned commands:
For Ubuntu/Debian based distros:
For CentOS 8, Red Hat (RHEL), and Fedora:
For OpenSUSE:
To display an image in terminal use:
And to close the image, press the “Esc” or “q” key. To specify the size of the images, use the “-geometry” option with the “display” command:
To manipulate the size of the image, use the “-resize” option:
Or use “%” sign with “-resize” flag:
How to display images in terminal using feh
“Feh” is another lightweight image viewer application designed to view images in the terminal. It not only displays images from your local drive but also from the internet through URLs. You can browse images in various forms such as montages, slideshows, thumbnails, etc. To install it on Linux, use the commands listed below:
For Ubuntu and Debian based distros:
To install it on Arch Linux:
To install it on FreeBSD and OpenBSD:
Once the installation is done, you can view the image using the command given below; I am displaying “image1.jpg” from the “Downloads” directory:
To run a slideshow, open the terminal in the directory containing images and execute:
To navigate images, use “left/right” arrow keys and zoom in and zoom out using “up/down” keys. To view more than one image on the screen, especially in montage format, use the “-m” (montage) option:
To open multiple images in multiple windows, use:
To quit, simply press the “Esc” key.
How to display images in terminal using Terminology
Images can also be viewed in a terminal emulator called “Terminology.” This feature-rich terminal emulator not only displays images in the terminal but also plays videos in it. To install it on Ubuntu and Debian based distributions, use:
To install it on Arch Linux:
To install it on Fedora, use:
For OpenSUSE, execute:
And to view to image, follow the syntax:
For instance:
To play video, use:
Terminology is one of the well-known terminal emulators and comes with tons of features and customization options.
Conclusion
Viewing digital media such as images/animated gifs in the terminal can be much more convenient for Linux users who spend most of their time working with the terminal. It can be helpful in various ways. We discussed four different approaches to display images in the terminal. But other utilities can help display images in the terminal, such as w3m, viu, and eog (eye of gnome). The terminal is an effective way to communicate with your system, and displaying digital media in the terminal enhances its functionality and helps the terminal users work more efficiently.