20080928

Ubuntu Photo Frame


About two years ago I converted an old laptop into a photo frame for the living room. There are plenty of examples of how to do this floating around on the web these days, so I am not going to cover that here. What I am going to talk about are the software aspects of this project, and my recent upgrade of my photo frame.

The frame had been working fine for almost two years, but a few months ago I upgraded my WiFi network at the house to WPA (finally), but that meant that I could no longer transfer files to the frame because the WiFi card I was using in it only supported WEP. Shortly after that, the frame started acting strangely, turning itself off about once a day, then finally not booting at all with the infamous “missing file” messages you get when Windows can't read the hard drive correctly.

The original software setup for this project was Windows 2000 with a small .NET application I wrote to scan a directory and display pictures from it. When it was time to display the next photo, the program would scan the directory and pick a new picture at random to display. The laptop hardware did not have enough “horsepower” to handle any kind of transitions or fades between photos, so the program just displayed the next photo on the screen without any transitions.

I brought the frame back to my cave, where I confirmed that the hard drive had indeed given out. I ordered a SYBA SY-IDE2CF-NB25 Ultra IDE to Compact Flash Adapter from StarSurplus, and with a 4GB Compact Flash card I had laying around, I now had a solid state hard drive for the frame. I also ordered a EDIMAX EW-7108PCg 802.11g/b Wireless LAN PC Card from NewEgg to allow WiFi access to the frame again. I selected this card because it is well supported under Linux and it is very inexpensive. Now that I had all the hardware ready, time to re-install the software.

I wanted to use Ubuntu for this project, because I am familiar with it, and this would give me an opportunity to learn about doing a very minimal installation. My goal was to use as little space on the flash drive as possible for the OS and supporting programs to leave room for photos. After a few practice runs setting up the system and trying different programs, I came up with the following recipe.

First, I installed Ubuntu Server, with the OpenSSH and Samba options. The server edition of Ubuntu doesn't install any kind of GUI (just a command prompt) and none of the heavy applications like OpenOffice, Evolution, etc. Then I got the Wifi card working (it wasn't detected during setup) and performed an upgrade to make sure I had the latest security patches. I setup Samba to allow access to the folder containing the pictures to be displayed. Next I apt-get installed xorg, dnotify, and feh. feh is a small, lightweight image display program for X. While playing around with different configurations, I discovered that even under Ubuntu, this laptop just didn't have what it takes to display transitions between photos, and so feh fit the bill almost perfectly.

I tweaked the xorg.conf file to prevent it from blanking the screen (I think it defaults to blank after 10 minutes), copied some photos to the frame, and fired off feh using xinit. And my photo slide show started up! The only problem with feh is that it only reads the files in the directory when it starts up, so if I add pictures to the directory later, I would have to restart the program in order for them to be shown. So I created the following script using dnotify to restart the program whenever any files in the folder have changed.


#!/bin/bash
export HOME=/home/teknynja
while true; do
killall -q feh
sleep 1
xinit /usr/bin/feh -rzFZD180 --hide-pointer /home/teknynja/Pictures &
dnotify -MCDRro /home/teknynja/Pictures
done

I made the script executable, and added a line to invoke the script from inside /etc/rc.local so that it would run when the system started up. After a couple of days of testing in the cave, I put everything back together and it is now back in the living room, displaying our family photos once again. It also has the added bonus of being completely silent, due to the solid state hard drive. The total space budget on the flash drive was 645MB for the OS and supporting programs, leaving around 3GB for photos, which is more than enough for now.

Once again I warn the readers that I still have a lot to learn about Linux, so any constructive comments are appreciated. If you have any questions or would like more details about this project, feel free to leave a comment and I will try to help you if I can.

1 comments:

Erik said...

Great post, I used it!
Just to let you know, feh has a new feature that might help simplify your installation:

-R, --reload int
Reload filelist and current image after int seconds. Useful for viewing HTTP webcams or frequently changing directories. (Note that the filelist reloading is still experimental.)
If an image is removed, feh will either show the next one or quit. However, if an image still exists, but can no longer be loaded, feh will continue to try loading it.

 
Template design by Amanda @ Blogger Buster