There are many GUI picture browsers on Linux. But I haven’t heard of or used any applications that display pictures on a terminal. Fortunately, I’ve just discovered an image viewer called FIM that can be used to display images on a terminal. FIM caught my attention because it is very lightweight compared to most GUI image browsers. Without hesitation, let’s see what it can do.
Display images in a terminal using FIM
FIM stands for Fbi IMproved. For those who don’t know, Fbi is the Frame Buffer ImageViewer in Linux. It uses the system’s frame buffer to display images directly from the command line. By default, it can display BMP, GIF, JPEG, PhotoCD, PNG, PPM, TIFF, and XWD on a terminal. For other formats, it tries to use ImageMagick’s transformation.
FIM is based on the Fbi and is a highly customizable and scripted image browser that is ideal for users of software such as Vim text editor or Mutt. It displays images in full screen and can be controlled with keyboard shortcuts (resizing, flipping, zooming). Unlike the Fbi, FIM is universal: it can open many file formats, and can display pictures in the following video modes:
- Graphical rendering using a Linux framebuffer device
- Under X/Xorg, using the SDL library, rendering graphically
- Graphical rendering using the Imlib2 library under X/Xorg.
- Render as ASCII character drawings using the AAlib library in any text console
FIM is completely free and open source.
Install the FIM
Deb-based systems such as Ubuntu and Linux Mint can get the FIM image viewer from the default repository. Therefore, you can install the FBI using the following command:
$ sudo apt-get install fim
Copy the code
If it does not include FIM in the repository of your Linux distribution, you can download the source code to compile and install it, as shown below.
Wget wget HTTP: / / http://download.savannah.nongnu.org/releases/fbi-improved/fim-0.6-trunk.tar.gz http://download.savannah.nongnu.org/releases/fbi-improved/fim-0.6-trunk.tar.gz.sig GPG -- search 'dezperado autistici GPG --verify Fim-0.6-trunk.tar.gz. sig --verify fim-0.6-trunk.tarCopy the code
Tar XZF fim-0.6-trunk.tar.gz CD fim-0.6-trunk. /configure --help=short /configure make su -c "make install"Copy the code
FIM usage
Once the installation is complete, you can use the following command to “auto zoom” the image displayed:
$ fim -a dog.jpg
Copy the code
Here is sample output from my Ubuntu host.
As you can see in the screenshot above, FIM does not use any external GUI image browsers. Instead, it uses our system’s frame buffer to display the image.
If you have multiple.jpg files in your current directory, you can open all of them using wildcards, as shown below.
$ fim -a * .jpg
Copy the code
To open all images in the directory, such as Pictures, run:
$ fim Pictures/
Copy the code
We can also recursively open the image in the folder and its subfolders and sort the list as follows.
$ fim -R Pictures/ --sort
Copy the code
To render an image in ASCII format, use the -t flag.
$ fim -t dog.jpg
Copy the code
To exit Fim, press ESC or Q.
Keyboard shortcuts
You can use a variety of keyboard shortcuts to manage images. For example, to load the next image and the previous image, press the PgUp/PgDown key. To double or reduce, use the + / – key. The following are common keys used to control images in FIM.
PageUp
/Down
: Previous/next picture+
/-
: Zoom in/outa
: Auto zoomw
: Adaptive widthh
: Adaptive heightj
/k
: Pan/upf
/m
: Flip/mirrorr
/R
: Rotation (clockwise/counterclockwise)ESC
/q
: quit
See the man page for complete details.
$ man fim
Copy the code
So, that’s it. I hope that was helpful. More excellent tools will follow. Stay tuned!
Cheers!
Via: www.ostechnix.com/how-to-disp…
[SK] [J]
This article is originally compiled by LCTT and released in Linux China