Last active
January 17, 2017 22:01
-
-
Save tyrelsouza/440f96f1dc582579d11d07e92df5b303 to your computer and use it in GitHub Desktop.
Take shot and timestamp and SIGUSR rpi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install imagmagick, nginx, and raspistill. | |
2. Set a call to take_shot.sh in cron. | |
3. Drop html to be served by nginx. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="refresh" content="30" /> | |
</head> | |
<body> | |
<img src="latest.jpg"> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=$(date +"%m/%d/%Y %R") | |
# Run raspistill as a cheap daemon. | |
ps aux|grep [r]aspistill || raspistill -o /var/www/html/pre_timestamp.jpg --nopreview -q 75 --metering spot --mode 1 -e jpg -s -t 0 & | |
# Send Signal to raspistill to take a picture | |
pkill -SIGUSR1 raspistill | |
# crop picture, and add timestamp | |
convert /var/www/html/pre_timestamp.jpg -crop 524x750+796+876 -font AvantGarde-Book \ | |
-pointsize 20 -fill white -annotate +846+926 "$DATE" \ | |
/var/www/html/latest.jpg | |
# make a backup | |
cp /var/www/html/latest.jpg /var/www/html/images/shot-$(date +"%Y-%m-%d_%H%M").jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment