Added colour-improvement for bw display
The function display_corrected_image also improves the image for the 2-colour E-Paper Display.
This commit is contained in:
parent
8b03dae42a
commit
3d0a7dca9f
@ -306,7 +306,7 @@ def main():
|
|||||||
# image.save(path+'before.bmp')
|
# image.save(path+'before.bmp')
|
||||||
width, height = image.size
|
width, height = image.size
|
||||||
pixels = image.load()
|
pixels = image.load()
|
||||||
# To-Do: Use lambda instead of double-loop
|
if display_colours == "bwr":
|
||||||
for x in range(width):
|
for x in range(width):
|
||||||
for y in range(height):
|
for y in range(height):
|
||||||
pixel = image.getpixel((x, y))
|
pixel = image.getpixel((x, y))
|
||||||
@ -318,6 +318,17 @@ def main():
|
|||||||
pixels[x, y] = (255, 0, 0)
|
pixels[x, y] = (255, 0, 0)
|
||||||
else:
|
else:
|
||||||
pixels[x, y] = (0, 0, 0)
|
pixels[x, y] = (0, 0, 0)
|
||||||
|
|
||||||
|
if display_colours == "bw":
|
||||||
|
for x in range(width):
|
||||||
|
for y in range(height):
|
||||||
|
pixel = image.getpixel((x, y))
|
||||||
|
red = pixel[0]
|
||||||
|
green = pixel[1]
|
||||||
|
if red > 240 and green > 240: #white
|
||||||
|
pixels[x, y] = (255, 255, 255)
|
||||||
|
else:
|
||||||
|
pixels[x, y] = (0, 0, 0)
|
||||||
print('Conversion finished. Enjoy a crisp image on the E-Paper')
|
print('Conversion finished. Enjoy a crisp image on the E-Paper')
|
||||||
|
|
||||||
# Uncomment following line to save the processed image
|
# Uncomment following line to save the processed image
|
||||||
|
Loading…
Reference in New Issue
Block a user