Ignore alpha value for average color calculation

pull/1/head
Linus 5 years ago
parent 2a5245cefa
commit 1310ce4528
  1. 2
      led-badge-11x44.py

@ -331,7 +331,7 @@ def bitmap_img(file):
pixel_color = im.getpixel( (x, row) ) pixel_color = im.getpixel( (x, row) )
print(pixel_color) print(pixel_color)
if isinstance(pixel_color, tuple): if isinstance(pixel_color, tuple):
monochrome_color = sum(pixel_color) / len(pixel_color) monochrome_color = sum(pixel_color[:3]) / len(pixel_color[:3])
elif isinstance(pixel_color, int): elif isinstance(pixel_color, int):
monochrome_color = pixel_color monochrome_color = pixel_color
else: else:

Loading…
Cancel
Save