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

Optional

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? Subscribe to premium for no-ads.

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.

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 in the nano text editor.

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 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

Conclusion

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 in the comments section below.

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 leave a comment. As always if you like my stuff be sure to follow Pi My Life Up on any major social network.

63 Comments

  1. Avatar for Brad
    Brad on

    Hello, I realize this is an old post But it works perfectly for someone new to pi like me! I combined this with your Samba installation post and can now slideshow photos from my main computer to several monitors with a Pi ZeroW attached to them. A couple questions;
    I find that I must leave atleast 1 image in the shared folder or else the slideshow stops before loading new images. I then need to “bash /home/pi/start-picture-frame.sh” again to restart it. Question 1, instead of reading from the shared folder, Is there a way to delete a whole folder of 60 or so images from the shared directory, then transfer a new folder of 60 or so images? and have the slideshow start displaying from the new folder after a period of time? this folder would be replaced with a new one every couple hours or so.

    And question 2, is there a way for the name of this folder of images to be overlayed onto the slideshow images, like a water-mark?

    Thank you! your information is clear and valuable!

    1. Avatar for Matt
      Matt on

      I have expanded upon Gus’ original settings here as I ran into the same issue. I changed the script to archive any images that are older than 14 days to an Archive folder, if there are no images in the main folder.

      I provided the script I use and you should be able to work off that. the -mtime parameter is set to 14 days for me which invokes a move of pictures to another folder. You could change it to delete any pictures over a certain period.

      #!/bin/bash
      
      find /home/pi/Pictures -maxdepth 1 -mtime +14 -type f -exec mv "{}" /home/pi/Archive/ \;
      
      COUNT=$(find /home/pi/Pictures/. -type f | wc -l)
      ACOUNT=$(find /home/pi/Archive/. -type f | wc -l)
      
      TIMER=`expr $COUNT \* 5`
      ATIMER=`expr $ACOUNT \* 5`
      
      if (($COUNT < 1)); then
      
      DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --auto-rotate -q -Z -z -F -V -R $TIMER -Y -D 5.0 /home/pi/Archive
      
      else
      
      DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --auto-rotate -q -Z -z -F -R $TIMER -Y -D 5.0 /home/pi/Pictures
      
      fi
  2. Avatar for Matt
    Matt on

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

    1. Avatar for Gus
      Gus on
      Editor

      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.

  3. Avatar for Frank
    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.

  4. Avatar for Nick
    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?

  5. Avatar for Michael
    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. Avatar for Gus
      Gus on
      Editor

      Hi Michael,

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

    2. Avatar for Minam
      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. Avatar for SoftBear
      SoftBear on

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

  6. Avatar for Jim
    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.

  7. Avatar for Richard C Williams
    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.

  8. Avatar for Jefferson
    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

  9. Avatar for Minam
    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

  10. Avatar for Tim
    Tim on

    How can I change the time between pictures?

  11. Avatar for Rohit Sutariya
    Rohit Sutariya on

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

    1. Avatar for Andrew Bayliss
      Andrew Bayliss on

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

    2. Avatar for Sierra B.
      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. Avatar for Sierra B
      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.

  12. Avatar for Jason
    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. Avatar for Andrew Bayliss
      Andrew Bayliss on

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

  13. Avatar for SPCoulson
    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 *