ShowerThoughts and EarthPorn: Make an Inspiring Raspberry Pi Photo Frame

Christian Cawley 12-07-2016

Digital photo frames are certainly nice to look at, but they can be rather inflexible, and family photos can be a little … well, boring. But if you add a screen to a Raspberry Pi, you can make something quite unique, by overlaying photos from r/earthporn with “inspirational” quotes from r/showerthoughts (or any combination of your favorite subreddits).


Want to make your own dynamic, digital, Raspberry Pi-powered talking point? Read on.

Prepare Your Pi

You’ll need to have the latest version of Raspbian 5 Ways New Raspbian Jessie Makes Raspberry Pi Even Easier to Use Following the release of Debian Jessie in July, the Raspberry Pi community has been blessed with a new release of the Raspbian variant, based on the "parent" distro. Read More  installed for this project, so if necessary download and write to your SD card How to Install an Operating System on a Raspberry Pi Here's how to install an OS on your Raspberry Pi and how to clone your perfect setup for quick disaster recovery. Read More . Once you’ve done that, take the time to setup wireless networking How to Set Up Wi-Fi and Bluetooth on Raspberry Pi Unlike older models, the Raspberry Pi 3 and 4 have Wi-Fi and Bluetooth capabilities. Here's how to set them up properly. Read More and enable SSH Setting Up Your Raspberry Pi For Headless Use With SSH The Raspberry Pi can accept SSH commands when connected to a local network (either by Ethernet or Wi-Fi), enabling you to easily set it up. The benefits of SSH go beyond upsetting the daily screening... Read More .

With all of this done and correctly configured, ensure that you have connected your Pi successfully to the intended display. This might be an old laptop monitor, a disused tablet or Kindle reader, or one of the displays designed for the Pi How to Setup Your Raspberry Pi Touchscreen The Raspberry Pi comes with a variety of useful add-ons, but one piece of kit that has proved particularly popular is the Raspberry Pi 7-inch Touchscreen Display. Here's how to set one up. Read More .


You should also take the steps required to expand the Raspberry Pi filesystem. This can be done in raspi-config in the command line What You Need to Know About Getting Started with Raspberry Pi The Raspberry Pi computer is the latest in a line of compact, multi-function devices, shipped as a barebones package so that end users can use the hardware for virtually any computing project that comes to... Read More or in the Menu > Preferences > Raspberry Pi Configuration box on the desktop.

Getting Content from Reddit


Rather than cycle through some photos stored on your Pi, you can use a Python script to find images from the web. The Reddit channels r/EarthPorn (beautiful, stunning photos of the Earth, and totally safe for work!) and r/ShowerThoughts are great candidates, and you can download the code from this scul86’s Github page. Download, ep_st.config and template.html and save all three files into the same location on your Raspberry Pi (perhaps home/pi/Frame), before editing ep_st.config:

sudo nano /home/pi/Frame/ep_st.config

Here, look for the text headed [FILEPATHS] and change these to match the location where you have saved the three files. If you’re not sure what the full filepath should be, cd into the file in the command line, and type pwd.


Note that you can also adjust the subreddits from which the script pulls text and images, though we’d suggest leaving them at the defaults for now.

When you’re done, hit Ctrl + X, then Y to confirm the changes.

Next, you need to install praw, a Python wrapper for the Reddit API. Install this with

sudo pip install praw

Wait while this is done, and then turn your attention to giving the the necessary permissions:

sudo chmod 777 /home/pi/Frame/

You should then make the file executable:

sudo chmod +x /home/pi/Frame/

To test the slideshow, cd into the Frame directory and run



In the GUI, browse to the Frame directory and find the newly-created ep_st.html. This is the result of the Python script and the settings you specified in the config file, so open this to see the results. The page is set to automatically refresh, and should update itself whenever a new inspirational image is created. If you’re worried about filling up your Pi drive space with these, don’t be: the images aren’t actually downloaded, it’s just creating an HTML file that points to them remotely (probably an IMGUR url) with a textual overlay.

At this stage, all that is left to do is set the slideshow to launch automatically when you boot your Raspberry Pi. To make this happen, we need the Python script to run, and the HTML file to open.

Begin by installing and configuring a browser. We’re going to use Midori, but you can select and configure pretty much any Pi-compatible browser.

First, open sudo raspi-config and Disable Overscan. Then, install the browser:

sudo apt-get install midori x11-xserver-utils matchbox unclutter

Next, open nano to create a script:

sudo nano /home/pi/

Here, enter the following:

unclutter &

matchbox-window-manager &

midori -e Fullscreen -a [URL]

Substitute [URL] with the webpage you wish to load at boot. For our ep_st.html file, saved in the /home/pi/Frame subdirectory, the line would read:

midori -e Fullscreen -a Frame/ep_st.html

Save this with Ctrl + X and confirm with Y.

Next, make it executable with

sudo chmod 755 /home/pi/

You should then edit the autostart file:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

At the end of the file (you may have some lines in here already from the setup of your Pi’s touchscreen display How to Setup Your Raspberry Pi Touchscreen The Raspberry Pi comes with a variety of useful add-ons, but one piece of kit that has proved particularly popular is the Raspberry Pi 7-inch Touchscreen Display. Here's how to set one up. Read More ) add:

@xset s off

@xset -dpms

@xset s noblank


Save and exit, then edit the rc.local file:

sudo nano /etc/rc.local

Here, add a new line above exit 0:

su -l pi -c startx

Save and exit, then reboot.

sudo reboot

Keeping the Lights On

By default, the Pi display — whatever display is connected — will be switched off after a few minutes of inactivity. We can deal with this by connecting via SSH (or using the Terminal if you have a keyboard plugged in) and editing the lightdm.conf file.

sudo nano /etc/lightdm/lightdm.conf

Find [SeatDefaults] (the brackets are included; you’ll find it towards the end of the file) and add this line under it:

xserver-command=X -s 0 -dpms

Save and exit with Ctrl + X and reboot:

sudo reboot

Your Own Inspirational Digital Picture Frame!

Let us know in the comments how this project went for you! Have you stuck with the defaults, or did you find some other sub-reddits that work well together? Or did you run into problems? Whatever happened, whatever you’ve done with this project, tell us about it in the comments!

Related topics: Raspberry Pi, Reddit.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

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

  1. Mowgli
    January 27, 2020 at 1:10 pm

    Will this work on a Raspberry Pi 4B?

  2. BP99
    April 2, 2019 at 10:04 pm

    Hope someone is still watching this thread. I was able to get it to work but now after a couple of refreshes it dies with this error:

    File "", line 300 in main
    f.write(template.substitute(img=img_url, text=witty_text))
    UnicodeEncodeError: 'ascii' codec can't encode character u'\u201c' in position 34: ordinal not in range(128)

    From what I've searched (not a python guru by any means) is to change the encode to UTF-8. Not sure how to do that here.

    Any help is appreciated.

  3. bboe
    January 5, 2017 at 6:09 am

    This project depends on an older version of PRAW. Can you update your instructions to install PRAW via: sudo pip install praw==3.6?

  4. David G
    October 5, 2016 at 2:10 am

    Is there anyway to make the script run without setting it up to autostart. Whenever I try it returns this:
    unclutter: could not open display
    matchbox: can't open display! check your DISPLAY variable.
    Midori - Cannot open display

    I want to be able to run it thru crontab so I can have a different script run part of the day.

  5. butch
    July 29, 2016 at 2:01 am

    Did MDM's issue get resolved? I'm working my way through this tutorial and I'm getting the same error. Any assistance is greatly appreciated. I'm a bit of a noob.

    raspberry pi 3.

    • Christian Cawley
      July 31, 2016 at 6:49 pm

      This is frustrating as at present I can't remount the project as I'm working on something else.

      Have you run it as python, or with sudo?

      Is Python up to date on your system?

      The system used in preparing the tutorial was running an older image of Raspbian but on a Raspberry Pi 3, if this is of any help to anyone. As soon as I can get the current project finished, I'll start working through this again.

      • Anonymous
        July 31, 2016 at 11:45 pm

        I ran it as the tutorial states. python

        Apologies as I'm a total noob, first pi, first project. I do understand some command lines, I'm just not very familiar with linux or python. Thank you for looking into this.

        Raspberrypi 3 Model B. I'm not sure if python is up to date with the system or not. Any advice on how to check?

        • Anonymous
          July 31, 2016 at 11:56 pm

          The pi says it's running python v 2.7.

        • Anonymous
          August 1, 2016 at 12:17 am

          After digging around, if I type in python --version, I get 2.7.9

          If I type in python3 --version, I get 3.4.2

          neither will allow the script to run, even if I do python3

        • Anonymous
          August 1, 2016 at 1:21 pm

          Issue resolved using the advice- "make sure you have the module installed with "sudo pip install configparser" or whatever the name is that it says you're missing."

      • mdm
        August 4, 2016 at 3:27 am

        Yes was all up to date, tried sudo as well

  6. mdm
    July 28, 2016 at 1:13 am

    Sorry ignore last comment long day, the following command


    • Christian Cawley
      July 28, 2016 at 7:34 am

      Okay, what do you have on line 23? is this a line you've edited?

      • mdm
        July 28, 2016 at 8:43 pm

        Did not edit that file at all, as i did not see any instruction to.
        Line 23
        import configparser

        • Christian Cawley
          July 29, 2016 at 7:38 am

          Fair enough. Really don't know why it wouldn't work unless there was a problem.

          Have you tried re-downloading?

        • mdm
          July 30, 2016 at 5:18 pm

          Have attempted on several different pi's

        • butch
          July 29, 2016 at 10:44 am

          I'm having the same issue. Did you find a resolution?

        • Anonymous
          July 29, 2016 at 10:47 am

          I'm having the same issue, did you find a resolution?

  7. mdm
    July 28, 2016 at 1:12 am

    Very sorry forgot to include that

    When running this command

    sudo nano /home/pi/Frame/ep_st.config

  8. Christian Cawley
    July 27, 2016 at 7:04 am

    At what stage does this occur, mdm?

  9. mdm
    July 27, 2016 at 2:50 am

    Getting an error

    Traceback (most recent call last):
    File "", line 23, in
    import configparser
    ImportError: No module named configparser