Skip to content

Instantly share code, notes, and snippets.

@vaelen
Last active June 30, 2016 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vaelen/0c4af3e6d767ddd4b40bd60ffa076742 to your computer and use it in GitHub Desktop.
Save vaelen/0c4af3e6d767ddd4b40bd60ffa076742 to your computer and use it in GitHub Desktop.
This script chooses a random wallpaper, resizes it, places the time on it, and displays it on a 320x240 AdaFruit PiTFT for Raspberry Pi using the framebuffer.
#!/bin/bash
export indir=${HOME}/wallpapers
export infile=`find ${indir} -type f | sort -R | tail -n 1`
export workdir=${HOME}/.wallpaper
export resizedfile=${workdir}/resized.png
export timefile=${workdir}/time.png
export outfile=${workdir}/time-final.png
export time=`date`
export loc=+15+200
mkdir -p ${workdir}
convert -resize 320x240 "${infile}" "${resizedfile}"
convert -size 320x240 xc:lightblue -transparent lightblue -pointsize 20 \
-stroke black -strokewidth 8 -annotate ${loc} "${time}" -blur 0x8 \
-fill white -stroke none -annotate ${loc} "${time}" \
"${timefile}"
composite -gravity center "${timefile}" "${resizedfile}" "${outfile}"
sudo fbi -T 2 -d /dev/fb1 -noverbose -a "${outfile}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment