-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
34 lines (27 loc) · 886 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from IT8951.display import AutoEPDDisplay
from IT8951.display import VirtualEPDDisplay
from IT8951 import constants
from PIL import Image
from time import sleep
V_COM = -1.77
def main(path, virtual=False):
if virtual:
display = VirtualEPDDisplay(vcom=V_COM)
else:
display = AutoEPDDisplay(vcom=V_COM)
# Make display clear
display.clear()
display.frame_buf.paste(0xFF, box=(0, 0, display.width, display.height))
img = Image.open(path)
dims = (display.width, display.height)
img.thumbnail(dims)
# Align image with bottom of display
paste_coords = [dims[i] - img.size[i] for i in (0,1)]
display.frame_buf.paste(img, paste_coords)
# Display the image
display.draw_full(constants.DisplayModes.GC16)
def clear_screen():
display = AutoEPDDisplay(vcom=V_COM)
display.clear()
main("images/Epcot.png")
#sleep(10)