Home Command line fun 3 CLI Image Viewers To Display Images In The Terminal

3 CLI Image Viewers To Display Images In The Terminal

By sk
79.4K views

There are plenty of GUI applications available to view images in Linux. But I haven't used any CLI applications yet which displays pictures in the Terminal itself. To my luck, I found 3 CLI image viewers to display images in Terminal itself. These applications could be useful for those who wants to use CLI alternatives for GUI apps and who live in Terminal mostly.

1. Display Images In the Terminal Using FIM

FIM stands for Fbi IMproved. For those who don't know, Fbi is a linux framebuffer imageviewer. It uses the system’s framebuffer to display images directly from the command line. By default, it displays bmp, gif, jpeg, PhotoCD, png, ppm, tiff, and xwd from the Terminal itself. For other formats, it will try to use ImageMagick's  convert. The FIM utility draw my attention, because it is very lightweight compared to most GUI picture viewer applications.

FIM is based on Fbi and it is a highly customizable and scriptable image viewer targeted at the users who are comfortable with software like the Vim text editor or the Mutt mail user agent. It displays the images in full screen and the images can be controlled (such as resize, flip, zoom) using keyboard shortcuts. Unlike fbi, the FIM utility is universal. It can open many file formats and it can display pictures in the following video modes:

  • Graphically, with the Linux framebuffer device.
  • Graphically, under X/Xorg, using the SDL library.
  • Graphically, under X/Xorg, using the Imlib2 library.
  • Rendered as ASCII Art in any textual console, using the AAlib library.

FIM is completely free and open source.

Install FIM

The FIM image viewer is available in the default repositories of DEB-based systems such as Ubuntu, Linux Mint. So, you can install fbi using command:

$ sudo apt-get install fim

If it is not available in the default repositories of your Linux distribution, you can download, compile and install from source as described in the section titled "Download and build instructions" in official documentation page.

FIM Usage

Once installed, you can display an image with "auto zoom" option using command:

$ fim -a dog.jpg

Here is the sample output from my Ubuntu box.

Display Images In the Terminal Using Fim

Display Images In the Terminal Using Fim

As you can see in the above screenshot, FIM didn't use any external GUI picture viewers. Instead, it uses our system's framebuffer to display the image.

If you have multiple .jpg files in the current directory, you could use wildcard to open all of them as shown below.

$ fim -a *.jpg

To open all images in a directory, for example Pictures, run:

$ fim Pictures/

We can also open the images recursively in a folder and its sub-folder and then sorting the list like below.

$ fim -R Pictures/ --sort

To render the image in ASCII format, you can use -t flag.

$ fim -t dog.jpg

To quit Fim, press ESC or q.

Keyboard shortcuts

You can use various keyboard shortcuts to manage the images. For example, to load next image and previous images, press PgUp/PgDown keys. Ton Zoom in or out, use +/- keys. Here is the common keys used to control images in FIM.

  • PageUp/Down : Prev/Next image
  • +/- : Zoom in/out
  • a : Autoscale
  • w : Fit to width
  • h : Fit to height
  • j/k : Pan down/up
  • f/m : flip/mirror
  • r/R : Rotate (Clock wise and ant-clock wise)
  • ESC/q : Quit

For complete details, refer man pages.

$ man fim

2. Display Images In the Terminal Using Viu

Viu is yet another command line application to view images from the Terminal. It is free, open source CLI image viewer written using Rust programming language. Using Viu we can;

  • Display popular type of image, including .jpg, .png, igif etc.
  • Display images in custom dimensions.
  • Display images directly from the image hosting platforms, for example giphy.

Install Viu

Since Viu is written in Rust, we can install it using Cargo package manager. After installing Rust in your Linux box, run the following command to install Viu.

$ cargo install viu

On Arch Linux and its derivatives, It can be installed from AUR using any AUR helper programs like Yay.

$ yay -S viu

Viu is also available as per-compiled binary. Download the latest binary from the releases page. As of writing this, the latest version was 0.2.1.

After downloading the Viu binary file, make it executable:

$ chmod +x viu

And, move it to your path, for example /usr/local/bin.

$ sudo mv viu /usr/local/bin/

Viu usage

Viu usage is trivial. Just type viu followed by the image path and hit ENTER key.

$ viu image.jpg

Sample output:

Display Images In the Terminal Using Viu

Display Images In the Terminal Using Viu

You can even display custom dimension image using -h (Height) or -w (Width) flags like below.

$ viu image.jpg -w 40

Sample output:

Display custom size image using Viu

Display custom size image using Viu

To display multiple images one after another in a folder, use wildcard characters like below.

$ viu Desktop/pic\ *

Like I already mentioned, Viu is capable of displaying different format images. For example, the following command will display the gif image using Viu:

$ viu animated.gif
Display animated images using viu

Display animated images

To exit, just press CTRL+C.

It is also possible to display the image hosting sites, for example Giphy, in Terminal like below.

$ curl -s https://media.giphy.com/media/6pUBXVTai18Iw/giphy.gif | viu -w 40

For more details about Viu, refer the help section by typing the command:

$ viu --help

3. Display Images In the Terminal Using Lsix

Unlike the previous two image viewers, Lsix will only display thumbnails in Terminal. It is like ‘ls’ command in Unix-like systems, but for images only. Lsix is a simple BASH script to view thumbnail images in Terminal using Sixel graphics. For more details about this script, please click the following link.

And, that's all for now. If you use/know any other CLI image viewers, please mention them in the comment section below. I will check and update the guide.

More good stuffs to come. Stay tuned!

Cheers!

Resources:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

7 comments

Stan Brown May 15, 2019 - 12:57 am

I use qiv, works great, and very flexible.

Reply
Chris McGimpsey-Jones May 24, 2019 - 4:11 am

I just installed the pre-compiled binary for viu onto my own Ubuntu installation. Thank you. Excellent tool. So simple.

Reply
sk May 24, 2019 - 11:42 am

Good to hear, Chris! Thank you.

Reply
Dedwarmo February 9, 2020 - 5:55 pm

I also find feh very useful. Can display images full screen. Will display all the images in directories recursively. You can give it a text file containing a path names to images. I’ve got 450,000 images listed in a text file and it will display them almost instantly. It will even randomize or sort the list in less than a second.

Reply
URxvt June 20, 2020 - 8:44 pm

I use sxiv, and I love it because it’s very customizable. I’m gonna make a script to use it everywhere with a shortcut, with some options predefined.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More