As a Linux power user, I spend most of my time working in the terminal. Being able to view images right in the terminal can be extremely convenient rather than having to open a separate image viewer application.

In this comprehensive guide, I will demonstrate several methods to display and view images of various formats like PNG, JPG, GIF, etc. directly in the Linux terminal.

Why View Images in Terminal?

Here are some of the benefits of viewing images in a Linux terminal:

  • Increased productivity – You don‘t have to switch contexts between a terminal and GUI application. Just type a command to instantly see the image.
  • Works over SSH – Remotely view images on a headless server over SSH without needing to install or configure a desktop environment.
  • Lightweight – Terminal-based viewers have lower overhead than heavyweight GUI apps.
  • Scripting capabilities – Automate batch image processing jobs by scripting image viewing commands.

So if you frequently work with images and also rely on the terminal, then being able to view images right in your shell is a huge convenience boost.

FIM – Frame Buffer Image Viewer

One of the most popular terminal-based image viewers on Linux is FIM. Let‘s install it first:

sudo apt install fim # Debian/Ubuntu
sudo dnf install fim # Fedora
sudo pacman -S fim # Arch Linux

The syntax to view an image with FIM is simple – just pass the image filename:

fim image.png

Kitten

FIM supports all common image formats like PNG, JPG, GIF, TIFF and more.

You can view images in full screen with the -a flag:

fim -a image.jpg

Use the Page Up, Page Down keys to cycle through images in a directory. Press a to automatically scale the image to fit the terminal size. Zoom in and out with + and -.

Overall FIM offers a smooth viewing experience right inside your terminal!

ImageMagick Display Command

ImageMagick is a hugely popular image manipulation toolkit for Linux. Most people use its convert and mogrify commands for transforming images.

But ImageMagick also provides the display command to simply view images in terminal!

First install ImageMagick:

sudo apt install imagemagick # Debian/Ubuntu
sudo dnf install ImageMagick # Fedora 
sudo pacman -S imagemagick # Arch

Then use display to view any image:

display image.jpg

Beach

You can resize images with the -resize option:

display -resize 50% image.png

Or specify absolute dimensions:

display -resize 400x300 image.gif 

So ImageMagick provides a handy terminal viewing utility while also powering robust image processing from the command line.

Feh – Lightweight and Fast Image Viewer

Feh is a blazing fast image viewer built for terminal usage. Let‘s install it:

sudo apt install feh         # Debian/Ubuntu
sudo dnf install feh        # Fedora
sudo pacman -S feh          # Arch
pkg install feh             # FreeBSD

View any image with feh followed by the filename:

feh image.png

Trees

You can launch a slideshow of all images in a directory:

feh *

View images in montage mode to display multiple images tiled together:

feh -m ./imgs

Open each image from a folder in a separate window with the -w flag:

feh -w images/*.jpg

Feh has a very fast render engine and loads even huge megapixel images instantly. It‘s optimized for terminal usage unlike some GUI apps that feel sluggish when rendered in a shell.

Overall it‘s a fantastic option for all your image viewing needs right within the terminal.

Tycat – View Images in Terminology Terminal

Terminology is an advanced terminal emulator for Linux with some unique features like viewing images and videos right within terminal windows!

First install Terminology on your Linux distribution.

Then instead of just running terminology, run:

tycat image.png

Flower

This will display the image directly in the Terminology terminal using its built-in tycat command.

You can also display a video this way:

tycat video.mp4

Terminology has highly customizable key bindings for controlling media playback right within terminal.

It‘s a great option if you want media viewing capabilities alongside your usual terminal workflow, all within a single advanced emulator instead of switching contexts.

FFplay – Play Videos in Terminal

FFplay is a media player built on top of FFmpeg, the leading multimedia framework for Linux.

You can use FFplay to watch videos right in your terminal by piping FFmpeg video output directly into FFplay.

First install FFmpeg and FFplay:

sudo apt install ffmpeg ffplay   # Debian/Ubuntu
sudo dnf install ffmpeg ffplay   # Fedora
sudo pacman -S ffmpeg ffplay     # Arch

Then pipe a video into ffplay:

ffmpeg -i video.mp4 -f nut - | ffplay -autoexit -

Beach video

This will playback the mp4 video right inside your terminal!

Use the arrow keys to control playback. Press q to quit.

You can even stream online videos:

ffmpeg -i http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -f nut - | ffplay -autoexit -

So ffplay gives you a quick way to watch videos in a terminal when you don‘t want to switch to a GUI player.

IMGKit – HTML5 Terminal Image Viewer

IMGKit is an interesting terminal image viewer option because it renders images using HTML5 Canvas and JavaScript to provide a unique viewing experience right in terminal.

The installation steps vary across Linux distributions. See the IMGKit GitHub page for instructions.

Once set up, launch IMGKit simply with:

imgcat image.png

Flower

You‘ll see the image rendered using HTML5 instead of plain terminal text glyphs.

Use the arrow keys or vim keys to scroll and navigate the image. Type h to see all the shortcut keys for controlling the image view.

IMGKit has a smooth scrolling effect and color handling compared to some basic terminal viewers. The HTML5 canvas rendering engine provides enhanced image viewing capabilities while still being fast and keyboard-oriented.

It‘s a unique hybrid terminal viewer that combines text UI convenience with graphical rendering sophistication!

MViewer – Media Viewer for Manga/Comics

MViewer is tailored specifically for reading manga, comics, and other image-heavy documents stored as archives of image files.

Install MViewer on Debian/Ubuntu systems with:

sudo apt install mviewer

Then inside a folder containing pages as page1.jpg, page2.png etc do:

mviewer .

Comic page

This will open the first image file in the folder and enable you to quickly navigate all the archives pages.

Use vim keys h l to go previous/next and arrow keys to scroll around the page.

MViewer has smooth scrolling, zooming and auto scales pages to fit width/height. All tailored for reading manga or comic archives!

Image Viewing Options in Neovim

The modal text editor Neovim has good terminal image integration via its :terminal command.

Open an image from within Neovim using the best external viewer for your system:

:terminal feh image.png

Flower

Or directly display it in terminal via kitty‘s icat:

:terminal kitty +kitten icat image.png

You can continue editing your text document in Neovim while viewing the image in a terminal split.

So Neovim provides GUI-style image integration but specifically within terminal without needing actual GUI components.

Conclusion

Viewing images right inside a Linux terminal alongside your usual text workflows can be tremendously convenient.

We covered multiple terminal viewers like FIM, ImageMagick, Feh, IMGKit that excel at displaying images of all formats in terminal.

More advanced options like Terminology and Neovim also let you seamlessly view media while working in terminal.

Now you have lots of options to pick from depending on if you want ultra simplicity vs more sophistication in how images render in terminal.

Try out some highly efficient image-oriented workflows using these nifty terminal image viewers on Linux!

Similar Posts