1

Current situation: a simple imageviewer in a loop. I'm displaying still images by using the framebuffer via fbi. I generate the list of images by a simple script right before firing it up. It runs in an infinite loop. To stop the slideshow, my script fetches the pid of fbi and kills the process.

Now I'd like to have some extra functionality by implementing a physical 'PREV' and 'NEXT' button, attached to the GPIO pins.

The most simple approach will be to launch a seperate process listening to those 2 buttons, kill the fbi process at press, re-write the imagelist and restart fbi. While this is easy to design, something tells me there must be a better, cleaner approach.

I assume I could modify the fbi source and implement the functionality right into it. This will take an awfull lot more effort though as my coding skills might not suffice to bring this approach to a good end.

What other approaches are possible?

angussidney
  • 703
  • 10
  • 21
EDP
  • 1,691
  • 1
  • 14
  • 24

1 Answers1

1

Given your issue seems to be with the messiness of restarting fbi, which is intended to be interactive program, here's a (perhaps) better approach (but still simple):

Get imagemagick:

sudo apt-get install imagemagick

Use it to convert images as needed directly to the framebuffer. Depends on your framebuffer (which you can details on in /sys/class/graphics). Lets say the framebuffer was 640x480, and color depth 8:8:8. Then you could use a single command line something like (untested):

convert -size 640x480 -depth 8 my_image.png rgb:- > /dev/fb0

There may be some trickiness if your fb is 5:6:5 format, as I believe imagemagick does not support that.

Note that because imagemagick's convert utility understands practically every image format, you can replace my_image.png with most any image. (Imagemagick has lots of other nifty features, too, for example if you wanted to add text or other overlays).

Brian
  • 577
  • 3
  • 9