Repository navigation
Expand file tree
/
Copy pathdraw_image.py
More file actions
52 lines (39 loc) · 1.47 KB
/
Copy pathdraw_image.py
File metadata and controls
52 lines (39 loc) · 1.47 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
"""
Copyright 2021 Rob Weber
This file is part of omni-epd
omni-epd is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import sys
from omni_epd import displayfactory, EPDNotFoundError
from PIL import Image
"""
This basic example will load your device (modify string below),
load an image, and then write it to the display
"""
# load your particular display using the displayfactory
displayName = "omni_epd.mock"
print('Loading display')
try:
epd = displayfactory.load_display_driver(displayName)
except EPDNotFoundError:
print(f"Couldn't find {displayName}")
sys.exit()
# if now load an image file using the Pillow lib
print('Loading image')
image = Image.open('../PIA03519_small.jpg')
# resize for your display
image = image.resize((epd.width, epd.height))
# prepare the epd, write the image, and close
print('Writing to display')
epd.prepare()
epd.display(image)
epd.close()