There are countless image viewers available for Linux, and as such the Raspberry Pi. Some offer enhanced modes, editing features, or a collection of filters, some though are just simple and easy to use; lightweight, but also capable of a surprising number of options. Feh is one such tool.
Feh is a lightweight, configurable and versatile image viewer. It is aimed at command line users, but can also be started from graphical file managers. Apart from viewing images, it can compile text and thumbnail listings, show (un)loadable files, set X11 backgrounds, and more.
Feh isn’t installed by default on the Raspberry Pi, so you’re going to need to drop into a Terminal and enter the following:
sudo apt-get install feh
The installation won’t take long, and if you’re asked to update anything or accept changes then answer ‘y’ to continue.
Once installed, navigate to a folder with images and simply enter: feh into the Terminal. The default feh window will begin to slideshow all the images you have in the folder you’ve executed feh in, simple press the left or right arrow keys to advance or scroll your mouse wheel.
You may notice that some of the images are too large for the feh window to display, if that’s the case you can close the current feh window and run the following in the Terminal:
feh --scale-down --auto-zoom
The images should now be displayed correctly.
Options, options and more options
Feh has an impressive number of options available via flags after the main command. For example:
Will launch a new window displaying a montage of the images in the current folder, you can then right-click each of the images to display further options and information regarding the image. Whereas:
Will launch all the images within the folder as separate Feh windows; make sure you don’t have too many images in the folder before doing this.
Will randomise the files in the slideshow. While:
Will reverse the order of the image files to be displayed.
There’s not enough room here to go into detail of all the options, so to browse through them yourself enter:
Which launches the Man pages for Feh.
Since this is a Linux command, it’s quite easy to include Feh in your Bash scripts or Python code. For example, if you wanted Feh to display some images from Python (make sure you’ve got Feh installed first), then you’d use the following:
cmd=”feh --scale-down --auto-zoom ~/Pictures/”
Change the directory in the cmd value to where the images are stored (we’ve used ~/Pictures/ here), save the Python code as fehpy.py, and run the command from the Terminal with:
Feh isn’t the best image viewer available to the Raspberry Pi, but it’s pretty good. If you want a quick and easy solution to viewing images via the Terminal, then running Feh on its own, or through a Python or Bash script will do the job well enough.