Skip to content

Digital Picture Frame Proof of Concept

Rob edited this page Aug 12, 2022 · 1 revision

The script below is a very simple Digital Picture Frame to show how omni-epd can be utilized to create an EPD project. There are lots of other applications, and more complex use cases for sure.

This script simply takes in the path to a directory, finds all PNG images in that directory, and displays one randomly on your EPD. This assumes you have omni-epd installed and working properly. The EPD type can be set at the top of the script.

#!/bin/bash -e
# epd_random_image.sh - display a random image, from a folder of images, on an EPD
# run the script with ./epd_random_image.sh /path/to/images
EPD="omni_epd.mock"

# setup some variables
DIR_PATH=$1
IMAGES=()

# get all PNG images in the path
for image in $DIR_PATH/*.png
do
  IMAGES=(${IMAGES[@]} "$image")
done

# get a random index
TOTAL=${#IMAGES[@]}
INDEX=$(($RANDOM % $TOTAL))

# UNCOMMENT LINES TO DEBUG
#echo "Path: $DIR_PATH"
#echo "Total images: ${TOTAL}"
#echo "Random Image: ${IMAGES[INDEX]}"

# display the image
omni-epd-test -e $EPD -i ${IMAGES[INDEX]}
Clone this wiki locally