iMac Digital Picture Frame

Ok, there are a gazillion DIY digital picture frames out there, this is nothing new. I figure I’d share it though because it shows a good use for outdated hardware but it also serves as documentation so six months from now when I’m asking myself “how did I do that?” I’ll have somewhere to look.

A few months ago I acquired an iMac G4 Lamp (Apple officially designates it the “iMac G4 Flat Panel”), which these days is a pretty useless piece of hardware; especially if it’s missing the OS like mine was. However, even with the hardware to slow to be of any real use, I felt like it would be a shame dump it. The iMac G4 has a great 17″ LCD so I figured it would make a great digital picture frame. Since my G4 was missing the OS, I decided to use the PowerPC version of Ubuntu1, and after some searching, testing, and cursing, I found that these instructions, with some tweaks to suite my needs worked the best.

EDIT: 3/24/2010 – Added missing step to install Samba, edited the fstab code to remove a space, and made note about Ubuntu version.

I won’t get into it here because there are already tons of HOWTOs (Google is your friend) but the first thing I did was to install Ubuntu Desktop.

NOTE: I originally set this up with Ubuntu 9.04 (Jaunty Jackalope) when I upgraded the Ubuntu install to Ubuntu 9.10 (Karmic Koala) something broke and feh refused to read pictures from the Windows share (despite is being mounted properly). I troubleshot the issue for a little bit to no avail and so decided to just go back to 9.04. Since this is not a production system (i.e. no used for anything but a digital frame) and has no access to the internet (blocked by firewall) I’m not worried about running an outdated version of Ubuntu. 9.10 may work perfectly fine and my issue could have stemmed from an in-place upgrade, not sure.

After Ubuntu was up and running I installed the image viewer feh by opening a terminal and entering:

sudo apt-get install feh

Like Vegard, my pictures are stored on another computer but accessible through a network share. I wanted to setup feh to display the the pictures stored on that computer; but unlike Vegard my frame will be connected to my network via a wired connection so I don’t need to mess with rsync like he did.

The first thing you want to do (if your pictures are stored on a Windows share like mine) is install Samba so that you can connect to it using cifs.

sudo apt-get install samba smbfs

That’s it no Samba configuration is necessary.

The second step is to create a mount point for the share. In a terminal I entered:

sudo mkdir /media/framepics

Next I edited the fstab config so that the share gets mounted to /media/framepics and stays persistent even after a reboot. Again, in a terminal I entered:

sudo nano /etc/fstab

This opens the fstab config in nano for editing. On the last like I entered:

//enterprise/phat_drive/data/pictures/imac_frame /media/framepics cifs username=yourusername,password=yourpassword,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Note – the above code should be placed on a single line.

Here’s a quick explanation of the fstab edit:

The first part:


Is the UNC path to the share where the pictures are stored – enterprise is my server and the rest of the path phat_drive/data/pictures/imac_frame leads to the folder where the frame pictures will be stored.

The second part:


Is the mount point I created, after the share is mounted I will be able to access the share from /media/framepics as if it were a local directory on the iMac.

The third part:


Is the file system used when accessing the share and as far as I can tell this is the best option; the share that’s being mounted is on a Windows box.

The fourth part:


Is where I put the user name and password needed to access the share on the Windows server.

The fifth part:


Is the character set used when accessing the share on the Windows server. Again, as far as I can tell from my reading this is what you want to use.

The sixth part:

file_mode=0777,dir_mode=0777 0 0

Is the file permissions set for the mount point – 0777 gives full access to the share from the iMac. Last two 0s are used to set the dump option and mount order, for this purpose 0 on both is fine.

Once the line was added to fstab I hit Ctrl X and answered Y to save the changes and exit out of nano. I then rebooted to make sure the share mounted properly after a reboot.

The next step was to set feh to start after a reboot, rescan the image directory periodically, and set the iMac to automatically turn the screen off at night and back on in the morning. I used the scripts from Vegard as a guide:

The first script is used to start feh:

#!/bin/bash export DISPLAY=:0 feh --quiet --recursive --randomize --hide-pointer --full-screen --slideshow-delay 300 /media/framepics/ &

delay is the time in seconds that the image is displayed; in this case 5 minutes. /media/framepics is where feh will look for images. I saved this file in my home directory (you could stick it anywhere) as and gave it execute permissions. I then went to system > Preferences > Startup Applications and added the script to the start up entries so feh would start automatically on boot.

The next three scripts are used in conjunction with cron to restart feh periodically and turn the screen on and off at scheduled times.

When feh starts it reads the images currently in the directory and will only show images that existed when it started. In order for newly added images to show I need to stop and restart feh periodically:

#!/bin/bash export DISPLAY=:0 killall feh feh --quiet --recursive --randomize --hide-pointer --full-screen --slideshow-delay 300 /media/framepics/ &

killall feh kills the feh process and the next line is exactly the same as the start-feh script. This script is also saved in my home directory as and given execute permissions.

This script turns the screen off:

#!/bin/bash export DISPLAY=:0 xset +dpms xset dpms force off

This script turns the display on:

#!/bin/bash export DISPLAY=:0 xset +dpms xset dpms force on

They were are also saved in my home directory as and and given execute permissions.

The next step is to setup cron so that,, and run at set times. Form the terminal:

crontab -e

I added the following:

00 07 * * 1-5 /home/adam/ 00 09 * * 0,6 /home/adam/ 00 23 * * 1-5 /home/adam/ 30 0 * * 0,6 /home/adam/ 0 * * * * /home/adam/

The first line sets cron to run at 7AM Monday – Friday.

The second line sets cron to run at 9AM Saturday and Sunday.

The third line sets cron to run at 11PM Monday – Friday.

The fourth line sets cron to run at 12AM Saturday and Sunday.

Finally, the fifth line sets cron to run every hour, to refresh the images. Every hour is probably excessive but whatever.

I then removed the desktop background image and set the background color to black, removed the desktop icons (I had to use gconf-editor to remove the mapped drive icon) and completely hid all the panels. With the background set to black, the icons and panels removed, all that shows when runs every hour is a blank black screen.

Adam ByersComment