Howto: Open Images in a Linux Console using fbi, a console based Image Viewer

Linux Console is not all about a black background with huge white, grey or green fonts. While working solely on console for a week I learned a lot about console based softwares. Remember the console based IM, Finch. It was built using nCurses but this time I will tell you about the magic of Frame buffers, a hardware-independent graphics layer which makes image viewing possible on Linux Consoles.

Its a common misconception that Image viewing is only possible in X windows, the software that provides a GUI to Linux, but thats not true. The Linux frame buffer provides a substantial graphics support along with support for various fonts and resolutions. Ever wondered how various Linux installers display graphics on text installations or show their logo while booting, without the presence of a X windows systems. Thats right, this is all possible because of Frame buffers.

Now, getting back to our console based image viewer, fbi. First lets begin with the installation part:

Install Fbi/Fbida on Ubuntu and Fedora

In Debian and Ubuntu the package comes under the name fbi. So, either click this link or run the following command to install it.

[shredder12]$ sudo apt-get install fbi

For Fedora, the package is under the name fbida. Use the following command to install it.

[shredder12]$ su -c 'yum install fbida'

Please note that, I am talking about the old school Linux Console, not the gnome-terminal. Press Ctrl-Alt-F1 to go to Linux Console(don't worry, none of your GUI tasks will be harmed) and use Ctrl-Alt-F7 to switch back.

The usage is simple. You will need root permission though.

[shredder12]$ sudo fbi image.png

At first, you might get this error

can handle only packed pixel frame buffers

This error hardly tells you how to fix the problem, I searched a lot and the fix was a little tweak in the grub menu. Just do this little change in your /boot/grub/menu.lst file, you boot option should look like this

kernel   /boot/vmlinuz-2.6.32-21-generic root=UUID=eb658c23-4213-4b2c-   ae4c-190eeb796972 ro   quiet splash vga=0x315

Note the extra option that I have added vga=0x315 to ensure a 1024x768 resolution with 24bit of colours(16.8 million). For more options you should check the Section 5.3 in this Frame Buffer Howto, after a little testing, you will find the appropriate one for you.

For grub2 users, since a little testing is required its better to do the change while booting. After the grub menu loads, press 'e' to edit the menu option and append the 'vga' option.

linux   /boot/vmlinuz-2.6.32-21-generic root=UUID=eb658c23-4213-4b2c-   ae4c-190eeb796972 ro   quiet splash vga=0x315

If right, fbi should show you an image. Various options may work for your hardware.

You can even load various images simultaneously and fbi will play a slideshow.

[shredder12]$ fbi *.png

This will show you all the png images of a file in the form of a slideshow, use PgUp and PgDwn to navigate through the images. You will more key and edit options in the man page of fbi.

From now on, don't ever under-estimate Linux Consoles . They can do a lot more than you know. 

2 Comments

Emacs (not verified)
June 27th, 2010 08:03 am
good , but vga=xxx is deprecated in Grub2
jzacsh (not verified)
June 28th, 2010 09:37 am
aaah, nice, I always knew this was possible -- just never knew how. thanks :)

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Use syntax $$latex$$ to insert LaTeX formulas.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.