Skip to content

Commit e55b9be

Browse files
authored
Merge pull request #49 from makermelissa/master
Make it easier to run bmp example on Python
2 parents 3726a3b + 90e7871 commit e55b9be

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

examples/epd_bitmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
display.rotation = 0
5151

52-
FILENAME = "blinka154mono.bmp"
52+
FILENAME = "blinka.bmp"
5353

5454

5555
def read_le(s):
@@ -68,7 +68,7 @@ class BMPError(Exception):
6868

6969
def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-branches
7070
try:
71-
f = open("/" + filename, "rb")
71+
f = open(filename, "rb")
7272
except OSError:
7373
print("Couldn't open file")
7474
return

examples/epd_pillow_image.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@
7171
# Crop and center the image
7272
x = scaled_width // 2 - display.width // 2
7373
y = scaled_height // 2 - display.height // 2
74-
image = image.crop((x, y, x + display.width, y + display.height))
74+
image = image.crop((x, y, x + display.width, y + display.height)).convert("RGB")
75+
76+
# Convert to Monochrome and Add dithering
77+
# image = image.convert("1").convert("L")
7578

7679
# Display image.
7780
display.image(image)

0 commit comments

Comments
 (0)