Merge pull request #49 from makermelissa/master
Make it easier to run bmp example on Python
This commit is contained in:
commit
e55b9be5fa
2 changed files with 6 additions and 3 deletions
|
|
@ -49,7 +49,7 @@ display = Adafruit_IL0373(
|
|||
|
||||
display.rotation = 0
|
||||
|
||||
FILENAME = "blinka154mono.bmp"
|
||||
FILENAME = "blinka.bmp"
|
||||
|
||||
|
||||
def read_le(s):
|
||||
|
|
@ -68,7 +68,7 @@ class BMPError(Exception):
|
|||
|
||||
def display_bitmap(epd, filename): # pylint: disable=too-many-locals, too-many-branches
|
||||
try:
|
||||
f = open("/" + filename, "rb")
|
||||
f = open(filename, "rb")
|
||||
except OSError:
|
||||
print("Couldn't open file")
|
||||
return
|
||||
|
|
|
|||
|
|
@ -71,7 +71,10 @@ image = image.resize((scaled_width, scaled_height), Image.BICUBIC)
|
|||
# Crop and center the image
|
||||
x = scaled_width // 2 - display.width // 2
|
||||
y = scaled_height // 2 - display.height // 2
|
||||
image = image.crop((x, y, x + display.width, y + display.height))
|
||||
image = image.crop((x, y, x + display.width, y + display.height)).convert("RGB")
|
||||
|
||||
# Convert to Monochrome and Add dithering
|
||||
# image = image.convert("1").convert("L")
|
||||
|
||||
# Display image.
|
||||
display.image(image)
|
||||
|
|
|
|||
Loading…
Reference in a new issue