Skip to content

Commit

Permalink
fix: Allow alpha channel to be ignored when converting three colour i…
Browse files Browse the repository at this point in the history
…mages.
  • Loading branch information
andrewjw committed Apr 26, 2024
1 parent e601f07 commit 1cb430e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/i75-convert-image
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def three_colour(im: Image.Image) -> bytes:
val: bytes = b""
for y in range(im.height):
for x in range(im.width):
r, g, b = im.getpixel((x, y))
try:
r, g, b = im.getpixel((x, y))
except ValueError:
r, g, b, a = im.getpixel((x, y))
val += r.to_bytes(1, byteorder='big')
val += g.to_bytes(1, byteorder='big')
val += b.to_bytes(1, byteorder='big')
Expand Down

0 comments on commit 1cb430e

Please sign in to comment.