33

I can view videos using OMXPlayer:

omxplayer -o hdmi video.h264

How do I do the same for still images?

5 Answers 5

38

You can use the command-line fbi app ("framebuffer image viewing"). The framebuffer is also what oxmplayer uses. Fbi is available from the raspbian repos and should be in any other GNU/Linux distro as well; it is not specific to the pi.

It takes a filename or series of filenames, and you can use shell globbing for this, so e.g.:

fbi *.jpg

Will show all the .jpg files in your current directory. For instructions on how to advance from one picture in the list to the next, see the KEYS section of man fbi. You can also set an automated slideshow with the -t option.

You may get this error:

ioctl VT_GETSTATE: Invalid argument (not a linux console?)

Even when logged in on a VT. The solution is to specify the framebuffer device, which should be:

fbi -d /dev/fb0 [...]

If you are using ssh, try:

fbi -T 1 [...]

Where "1" is the number of your current VT ("virtual terminal", aka. VC, "virtual console"; these are accessed via ctrl-alt-F[1-6]). You do not have to be logged in on the VT where the image will be displayed, so you can log in remotely and use this to put images on a display attached to the pi (presuming the correct VT is on screen). -T is not in the man page, but it is listed with fbi --help.

Note you cannot use this to view the image on a remote terminal; those aren't associated with the framebuffer.

A couple of other useful options are -a, which will zoom the images to fit on the screen if they are too large, and --edit, which allows you to rotate images (I believe they are then saved with that rotation, you may want to check that if it presents an issue).

4
  • Thanks. I have tried fbi -d /dev/fb0 photo.jpg but I still get the error that you mention. I'm logged into the Pi via SSH from Kubuntu Linux's Konsole terminal emulator. Have you any ideas how to fix this?
    – dotancohen
    Aug 9, 2013 at 15:47
  • 1
    You're right -- in fact the intuituve -d /dev/tty1 does not work either, but some googling revealed -T 1 (open via VT1) which is not documented in the man page :/ So try that (presuming it is the first VT that you see on the screen); I will edit something in above, and let me know here if it worked.
    – goldilocks
    Aug 9, 2013 at 16:04
  • Thank you. Interestingly, I did google around but did not find the -T 1 flag. Although using the command does in fact prevent the not a linux console? message, no image appears! Perusing the man page does uncover: "fbi also needs access to the linux console (i.e. /dev/ttyN) for sane console switch handling. That is obviously no problem for console logins,but any kind of a pseudo tty (xterm, ssh, screen, ...) will not work." Even dropping out of tmux didn't help. Do you say that you have managed to display images via SSH without X?
    – dotancohen
    Aug 11, 2013 at 6:55
  • 1
    No, you cannot view the framebuffer remotely, you can just control it.
    – goldilocks
    Jun 15, 2015 at 13:12
9

Working cmdline for me (this way I display image on HDMI-monitor while connected to Rpi by ssh):

sudo fbi -T 2 img.jpg
1
  • this works perfect when i use an external mini display connected via s-video.
    – dy_
    Aug 5, 2014 at 11:53
0

Sudo fbi -T -device /dev/fb0 -a img.jpg

Works for me, but no key control..

3
  • 1
    This answer needs a little more detail. It should at least address the question of whether this works with non console logins - as described above. Aug 27, 2013 at 0:08
  • @SteveRobillard why should not it work from non-console logins? there's only one framebuffer, no matter where you log in from...
    – lenik
    Aug 27, 2013 at 0:49
  • It may well work, but it does not explicitly address the issues discussed in the comments above. It would also help to make clear if key control is possible. Aug 27, 2013 at 1:06
0

As I was trying to write to a spi framebuffer with no VT attached comes up as /dev/fb2

http://www.hardkernel.com/main/products/prdt_info.php?g_code=G142060963922

fbi -T 1 -d /dev/fb2 -noverbose my.jpg

I found I needed to to use -T 1 to give fbi a VT it doesn't seem to matter which one

-noverbose was because I don't want text showing

I was running that command from within X11 which did have the side effect of temporarly overwriting the X11 buffer but the op and myself won't be running X11 it's not a issue, I was just testing the fb device for now

I don't really care about control as I just call fbi again when I want to show the next image

I was on a odroid C1 with openSUSE but that shouldn't matter

0

I found that 'sudo fbi -vt ' works.

You need to invoke 'sudo' to run fbi, to be able to access the actual virtual console which 'screen' is running on. (And hopefully you're not already running as root..!) :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.