Add files via upload

pull/1/head
kitazaki 5 years ago committed by GitHub
parent 5282f04bd0
commit 24fbf46971
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      led-badge-11x44.py

@ -328,13 +328,14 @@ def bitmap_img(file):
for bit in range(8): for bit in range(8):
bit_val = 0 bit_val = 0
x = 8*col+bit x = 8*col+bit
pixel_color = im.getpixel( (x, row) ) if x < im.width:
if isinstance(pixel_color, tuple): pixel_color = im.getpixel( (x, row) )
monochrome_color = sum(pixel_color[:3]) / len(pixel_color[:3]) if isinstance(pixel_color, tuple):
elif isinstance(pixel_color, int): monochrome_color = sum(pixel_color[:3]) / len(pixel_color[:3])
monochrome_color = pixel_color elif isinstance(pixel_color, int):
else: monochrome_color = pixel_color
sys.exit("%s: Unknown pixel format detected (%s)!" % (file, pixel_color)) else:
sys.exit("%s: Unknown pixel format detected (%s)!" % (file, pixel_color))
if x < im.width and monochrome_color > 127: if x < im.width and monochrome_color > 127:
bit_val = 1 << (7-bit) bit_val = 1 << (7-bit)
byte_val += bit_val byte_val += bit_val

Loading…
Cancel
Save