A Simple Raspberry Pi Photo Frame

The Raspberry Pi photo frame is a perfect setup for anyone who wants to display photos of their loved ones, memories or anything else might want to display.

Raspberry Pi Photo Frame

This photo frame is a pretty straightforward project and shouldn’t take you too long to set up. You will need the full version of Raspbian installed as we make use of the graphical user interface (GUI).

I pretty much only cover the software side of things in this tutorial there are some pretty cool frame designs out there if you want to extend this further.

The digital photo frame we make is very basic and can be kept completely offline. Connecting to services such as Google Drive and Flickr will require a lot more work.

Equipment

The equipment that you will need for this digital photo frame is listed below.

Recommended

Raspberry Pi

SD Card or Micro SD Card if you’re using a Raspberry Pi 2, 3 or B+ (8 GB+ Recommended)

Ethernet Cord or Wifi dongle

External Hard drive or USB Drive

Touch Screen or LCD screen

Optional

Raspberry Pi Case

USB Keyboard

USB Mouse

Video

If you want to see a video on how to do this tutorial, then be sure to check out the one below.

I go through everything you need to know about getting this project working.

Adblock blocking the video? Support us by subscribing to our ad-free service.

Hardware

For this project, I am just using the official Raspberry Pi touchscreen that I purchased earlier this year. However, you can use pretty much any screen that you can get your hands on. Just make sure you can hook it up to the Pi either over the DSI port, HDMI port or using a custom HAT.

If you’re looking for some 3D printable frames for either the official touch screen or just a spare screen you have, then Thingiverse has some pretty cool designs. You can find them over at Thingiverse.com.

Setting Up the Raspberry Pi Photo Frame Software

To get this all setup correctly we are going to need to do a bit of setup on the software side of things.

Firstly, we want to prevent the screen from going blank. It is a power saving setting on the Pi.

1. To turn off screen blanking open up the lightdm.conf file.

sudo nano /etc/lightdm/lightdm.conf

2. Now in here add the following line anywhere beneath the [SeatsDefaults] line.

xserver-command=X -s 0 –dpms

raspberry pi black screen

3. Save & exit by pressing ctrl+x and then y.

4. Now reboot the Pi, and the screen should no longer switch off after 10 minutes of inactivity. To reboot simply run the following:

sudo reboot

If you want to be able to drag and drop your images onto the Pi, you may want to look at setting up a network attached storage. Will allow you to set up a folder that is available on your local network. If you’re in doing such a thing, then my guide on a Raspberry Pi Samba server will take you through all the necessary steps.

I also highly recommend that you setup SSH so you will have remote access when the slideshow is in action. There is no easy way to exit the slideshow unless you turn the device on and off and don’t have it automatically starting.

To set up our slideshow, we’re going to use the feh package.  Feh is image viewer and cataloguer. It is a fast image viewer that doesn’t get bogged down with huge GUI dependencies. I chose this as it was the most lightweight package that worked without any huge complications.

1. To install the package, use the following line:

sudo apt-get install feh

2. Now to test that it works enter the following line. Replace /media/NASHDD1/test with the directory that contains all your image.

DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --quiet --preload --randomize --full-screen --reload 60 -Y --slideshow-delay 15.0 /media/NASHDD1/test

3. Now we can use short tags to make this command a lot shorter. You can read more about all the flags you can use over at the feh manual page.

DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -p -Z -F -R  60 -Y -D 15.0 /media/NASHDD1/test

4. Now as you will notice this locks up the command line bar. To fix this, add the & after the command and the script/process will launch in the background.

5. So now let’s store this in a simple script file. This way you can add or change it later. To make the file enter the following command:

sudo nano /home/pi/start-picture-frame.sh

6. In here, enter the following lines.

#!/bin/bash
DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -p -Z -F -R  60 -Y -D 15.0 /media/NASHDD1/test

7. Now that’s done you can test it by running the following command.

bash /home/pi/start-picture-frame.sh

8. Finally, let’s have it start at boot. Now it is important that you have SSH enabled so you can access the Pi remotely as you will lose access to the GUI/Screen. So make sure you have done this before setting it to launch at boot up.

9. To do this open up the rc.local file by entering the following command.

sudo nano /etc/rc.local

10. Add the following before the exit 0 line in this folder.

sleep 10
bash /home/pi/start-picture-frame.sh &

11. If you ever need to kill the process as you may want to be able to access the desktop, simply enter the following line.

sudo pkill feh

You should now have your very own slideshow of pictures going. If you end up with any troubles, then double check all the steps and look for any errors. If you’re still having trouble, then be sure to seek help on our forums.

I hope you have been able to get your Raspberry Pi photo frame working correctly. If you have any trouble or have an extension that you would like to share, then be sure to drop a comment on the forum. As always if you like my stuff be sure to follow Pi My Life Up on any major social network.

61 Comments

  1. Matt on

    One question, I am using the light version of the OS? Your instructions do not state which version.

    1. Gus on

      Sorry about that, it’s using the full version of Raspbian since we need the GUI. I have it on the “to do” list to add a section for Raspbian lite, but could be awhile before we get to it.

  2. Frank on

    Use “man feh” to see all the options for feh – one of them is –auto-rotate which will use the EXIF data to display images the right way up.

  3. Nick on

    hey guys, ive got everything up and running to the point i can run the picture-frame.sh script my images are stored on the sd card in home/pi/Pictures. The only problem is some of my pictures appear upside down despite them looking correct in the file manager?

  4. Michael on

    Hi! I’ve been trying to find out what I missed.

    I am getting this line when I hit “enter” after typing bash /home/pi/start-picture-frame.sh

    The line reads:
    /home/pi/start-picture-frame.sh: line 2: DISPLAY:0.0: command not found

    Thank you for sharing the wonderful tutorial.

    1. Gus on

      Hi Michael,

      I haven’t run into this issue before, what version of Raspbian are you running ?

    2. Minam on

      I had this issue before. Did you install a lite version of raspbian ? You need to have a GUI running (startx). Or you didn’t install feh but that would be weird ;).
      You will encounter many bugs actually. Because this tuto was made in 2015.
      Good luck !

    3. SoftBear on

      Looks like a typo to me: Try DISPLAY=0:0?

  5. Jim on

    I can autorun if i boot directly into gui without any trouble, but booting to command just won’t do it. bummer. seems like a waste of memory through the gui.

  6. Richard C Williams on

    Thanks so much for this project instructions. I created a frame for my coworkers and I know they will love it. I wonder if I can add a cron job, so it turns on and off at set times.

  7. Jefferson on

    Good Job! It went successfully. Thank you so much for this tutorial.

    I have one thing I really want to know. Is there any tools beside from “feh” to use transitions every picture? Really need your help tho

  8. Minam on

    Hello,

    Thanks a lot, I finally did it.

    Can you please give your os version in your tutorial.

    For the record, if you are using raspbian jessie PIXEL you need to use xfce4-power-manager to remove the screensaver/blank screen

    sudo apt-get install xfce4-power-manager

    then go to menu>settings>power management.

    Have fun
    Minam

  9. Tim on

    How can I change the time between pictures?

  10. Rohit Sutariya on

    I don’t my images randomize but continue scroll how it is possible plzzz tell me

    1. Andrew Bayliss on

      Rohit, if you supply the feh command with the –randomize parameter, it will randomly show the photos

    2. Sierra B. on

      Type man feh to see the options.

      Actually, -R isn’t randomize.
      It’s reload and takes a parameter for how often to refresh the photo list. This is very handy, since you can drop a ton of photos into the folder via SAMBA and then delete the ones that don’t look great on the digital picture frame.

      -z is the randomize option. I changed the option in the .sh file from -Z to -z and that worked to make them random. Capital -Z is supposed to zoom the pics to full screen, but it hadn’t been doing that prior to my edit. I don’t want zoom, so I’m not going to worry about why that was.

    3. Sierra B on

      Follow up to myself:

      Actually, the randomizing still isn’t working. I will try the spelled out flag, next time I log in to the picture frame.

  11. Jason on

    Is there any way to pull the pictures off a website like imgur or an online repository instead of a local folder?

    1. Andrew Bayliss on

      Jason, an earlier comment from Dan King suggested DakBoard could do this, so might be worth checking out.

  12. SPCoulson on

    So… I have sat as N00b trying to set up my Ras Pi 3 as a photo frame…

    I have experience most of the issues everyone else has had.

    One thing that really borked things was as it rebooted, feh wouldn’t start. I tried everything. bash su -pi -c gave me errors and I was about to headbutt the wall … then I watched the video.

    One bit missing from the typed instructions is … sleep 10. Yes, watch the video realllly carefully and it is in there. I won’t spoil the fun, but it works.

    Yep – I did that and bingo – worked first time.

    I have now followed the instructions in the following forum to alter my HDMI settings as I am using a HDMI to VGA adapter to connect this to an old monitor. Obviously, the resolution from HDMI to old VGA is different so the image was squished up on the left.

    https://www.raspberrypi.org/forums/viewtopic.php?p=269212

    HDMI Safe sounds like something I didn’t want to alter, but it worked a treat to correct the resolution. (phew!)

    For good measure I did CEA to find what my monitor was native at and changed the hdmi mode to match my monitor (23).

    All in all, as a complete “never done this before” I am really proud that I have got my set up now working.

Leave a Reply

Your email address will not be published. Required fields are marked *