Linux.com

Feature

CLI Magic: Feh for image viewing

By Michael Stutz on July 31, 2006 (8:00:00 AM)

Share    Print    Comments   

Too many Linux image viewers are tinged with little annoyances -- they take too long to load, are slow to redraw the display, have limited format support, sport inconvenient controls -- so when you want to settle on one, inevitably there's something to make you utter feh! in general discontent. Good call -- feh is the name of a speedy little viewer that packs in a surprising number of features for its size.

Feh takes as arguments the names of image files you want to view. You can also give directory names, and feh attempts to load all the files in that directory; the -r option recurses through all subdirectories. Viewing all image files in the /usr/local/photos directory tree, for instance, is done like this:

$ feh -r /usr/local/photos

If you specify more than one image, only the first will immediately display; type n (or the spacebar) to move to the next and p to move to the previous. The Home and End keys bring you to the first and last images in the argument list. To quit viewing and exit, type q.

You can put a list of images to load in a file, with full or relative pathnames, and specify the file with the -f option; the -z option will randomize the display order. The images can be advanced automatically by giving a delay, in seconds, as an argument to the -D option. This slideshow mode is the default mode; feh is a modal viewer, so its options and controls differ depending on the mode. Its other modes are discussed below.

You can also view images over any http or ftp URL by giving the URL as an argument, like so:

$ feh http://www.glerl.noaa.gov/pubs/photogallery/Scenic/images/0534.jpg

If you have a file that contains a list of image URLs, you can have feh display them in a random-order slideshow, with a delay of 30 seconds each, with this command:

$ cat image-urls | xargs feh -z -D30

Mouse controls

What's really special about feh is the way it pans and zooms images -- it's impressively fast and fluid.

If an image is too large to fit the display, click the left mouse button and move the pointer to pan around the image.

To resize the view, click the middle button and move the pointer toward the left or right to shrink or grow the image.

You can click and release the left mouse button once to move to the next image. A few viewing effects are also available: hold down the Ctrl key and press the left mouse button: when you do so, moving the pointer to the left blurs the image, while moving to the right sharpens it. With Ctrl and the middle mouse button pressed, you can move the pointer to spin the image around its center.

When viewing an image, click the right mouse button to display feh's menus.

Menus, edits, and modes

Feh is strictly an image viewer -- it doesn't attempt to be an editor at all, but a couple of the most common editing commands are available on the menu: rotation and deletion. Happily, there are no confirmation dialogs or windows that pop up when you do anything with these menus -- the delete command is cleverly given an extra sub-menu with one item, "confirm," so you get that extra protection against accidents but don't waste time with a verification click.

These commands also have keyboard equivalents. Type > to rotate an image 90 degrees clockwise, and < to rotate it 90 degrees counterclockwise. Your changes are immediately saved to the file. To delete the current image file, type Ctrl-Del.

While these commands work in slideshow mode, there are other operation modes as well, all of which are specified by command-line options. Here's a quick rundown of them:

Multiwindow mode

The -w option starts multiwindow mode, which works like slideshow mode, but instead of displaying images in tandem in a single window, all images are loaded at once, each in a window of its own. Quitting out of a single window closes all of the windows -- to just close a single window, type x inside that window.

Fullscreen mode

The -F option specifies fullscreen mode, where images are shown in the entire display. It works the same as slideshow mode and has all the same options.

Montage mode

The -m option specifies montage mode, where feh displays an image montage of thumbnails for all specified files. This mode has a lot of its own options; one of the more useful ones is -O, which doesn't display the thumbnail montage but instead saves it to the file you specify as an argument.

Collage mode

The -c option specifies collage mode, which like montage mode creates a new image of thumbnails, but images in the montage are displayed in a random, overlapping collage.

Index mode

The -i option specifies index mode, which makes an index print -- a new image of thumbnails with information about the images beneath them. The default is to just print the file's name, but if you call index mode with the -I option instead, it also prints each file's image (pixel) size and disk size in kilobytes. You can specify the font with the -e option.

Thumbnail mode

The -t option specifies thumbnail mode, which is one of the more useful modes -- it looks just like index mode, but you can view the full-size images by clicking on their thumbnails.

List mode

The -l option specifies list mode, which outputs a listing of images with various information about them including format and size.

For instance, here's how to get a default-style listing of all .jpg image files in the current directory:

$ feh -l *.jpg
NUM     FORMAT  WIDTH   HEIGHT  PIXELS  SIZE(bytes)     ALPHA   FILENAME
1       jpeg    800     534     427200  57600           -       0383.jpg
2       jpeg    570     800     456000  69362           -       0868.jpg
3       jpeg    800     526     420800  58995           -       0894.jpg
4       jpeg    800     599     479200  82414           -       1197.jpg
5       jpeg    800     601     480800  86439           -       1294.jpg
$

You can also customize the output (which is good for scripting) by using the -L option instead -- feh's man page describes how to specify the format.

Share    Print    Comments   

Comments

on CLI Magic: Feh for image viewing

Note: Comments are owned by the poster. We are not responsible for their content.

feh is indeed a great app

Posted by: Anonymous Coward on July 31, 2006 07:27 PM
super fast, and meets the power user needs. great app!

#

Re:feh is indeed a great app

Posted by: Anonymous Coward on August 01, 2006 06:37 AM
Yeah, thanks for the article, it's really a nice image viewer. Unfortunatly, development is very slow now<nobr> <wbr></nobr>:(

#

Re:feh is indeed a great app

Posted by: Anonymous Coward on August 01, 2006 03:58 PM
feh is indeed a nice app. By the way, a buddy of mine is doing a similar app without imlib2 dependency:

<a href="http://pekdon.net/pages/view/projects:geh" title="pekdon.net">http://pekdon.net/pages/view/projects:geh</a pekdon.net>

#

Quite OK

Posted by: Anonymous Coward on August 01, 2006 07:36 PM
But XV is much better and it's one of the oldest tools I got. I can't understand, why no one tried to put all the stuff that's in XV into something new and more. feh has nice options like direct URL viewing, and maybe it would be ok to put it into some new XV too, but right now, for fast viewing XV is the only possible and usable solution.

Mermgfurt,
Udo

#

an other great alternative ...

Posted by: Anonymous Coward on August 03, 2006 04:06 PM
is qiv, my alltime favourite. Small, fast, keyboard controller and with a resonable amount of features.

-- Jake Seevers

#

Re:an other great alternative ...

Posted by: Anonymous Coward on August 04, 2006 05:58 PM
The problem with qiv (which I have been using for years) is that it can not scale the image efficiently. If you hold down the [+] key it will all but lock up your computer.

The other image viewer I use [when running the binary nVIDIA drivers] is "gliv", which is the "GL Image Viewer". Because it uses hardware, it can do extremely fast real-time scaling, rotating and crossfading of images (that last one is great for a slideshows). Apparently feh can perform similarly to gliv, but I haven't tried feh yet.


  - raven morris

#

xzgv FTW

Posted by: Anonymous Coward on August 07, 2006 03:12 PM
I still haven't found anything that will replace xzgv any time soon. Being able to quickly hop from directory to directory to view the images therein is a big win for me. (And of course being gtk1.2 it's blazingly fast on my pentium-III...)

-MD

#

CLI Magic: Feh for image viewing

Posted by: Anonymous [ip: 69.249.175.13] on December 09, 2007 07:45 AM
This program is just what I wanted since it does random image slideshows.

I also like that I can delete images just by hitting the Delete key and not having to confirm from there.

The only thing that I don't like is that it doesn't have an optional frontend to start it.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya