Last active
April 19, 2018 12:01
-
-
Save libbymiller/8fe783397e342ce6f2747964158c899d to your computer and use it in GitHub Desktop.
e-ink chromium waveshare
This file contains 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
import epd7in5 | |
import Image | |
import ImageDraw | |
import ImageFont | |
EPD_WIDTH = 640 | |
EPD_HEIGHT = 384 | |
def main(): | |
epd = epd7in5.EPD() | |
epd.init() | |
# For simplicity, the arguments are explicit numerical coordinates | |
image = Image.new('1', (EPD_WIDTH, EPD_HEIGHT), 1) # 1: clear the frame | |
draw = ImageDraw.Draw(image) | |
image = Image.open('screenshot.png') | |
epd.display_frame(epd.get_frame_buffer(image)) | |
if __name__ == '__main__': | |
main() |
This file contains 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
# this is lightly edited version of @andrewn's work: https://github.com/andrewn/resin-epaper to work with the waveshare 7.5" | |
import epd7in5 | |
import Image | |
import ImageDraw | |
import ImageFont | |
EPD_WIDTH = 640 | |
EPD_HEIGHT = 384 | |
def main(): | |
epd = epd7in5.EPD() | |
epd.init() | |
# For simplicity, the arguments are explicit numerical coordinates | |
image = Image.new('1', (EPD_WIDTH, EPD_HEIGHT), 1) # 1: clear the frame | |
draw = ImageDraw.Draw(image) | |
image = Image.open('screenshot.png') | |
epd.display_frame(epd.get_frame_buffer(image)) | |
if __name__ == '__main__': | |
main() | |
echo "Running at $(date -R)" | |
echo "Timezone is $TZ" | |
# Take a screenshot | |
chromium-browser --headless --disable-gpu --no-sandbox --hide-scrollbars --screenshot --window-size=640,384 https://www.bbc.co.uk/ | |
# xargs trims surrounding whitespace | |
nextFileHash=$(sha1sum screenshot.png | xargs) | |
lastFileHash=$(cat last-file-hash.txt | xargs) | |
echo "Comparing hashes" | |
echo $lastFileHash | |
echo $nextFileHash | |
if [ "$nextFileHash" == "$lastFileHash" ]; then | |
echo "screenshot is the same, exiting" | |
exit 0 | |
fi | |
echo $nextFileHash > last-file-hash.txt | |
# Rotate screenshot | |
# Because the output from chromium gets messed up when | |
# the display rotates it | |
##convert screenshot.png -colorspace gray +matte -depth 2 -rotate -90 screenshot.png | |
convert screenshot.png -colorspace gray +matte -depth 2 screenshot.png | |
# Draw nice logo | |
python screenshot.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment