Skip to content

Commit

Permalink
Merge pull request #11 from eried/world_map.py
Browse files Browse the repository at this point in the history
Update world_map.py
  • Loading branch information
eried authored May 2, 2020
2 parents 76de128 + 31a04f4 commit 6a22fbf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions firmware/tools/world_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

outfile = open('../../sdcard/world_map.bin', 'wb')

# Allow for bigger images
Image.MAX_IMAGE_PIXELS = 1933120000
im = Image.open("../../sdcard/world_map.jpg")
pix = im.load()

Expand All @@ -35,14 +37,14 @@
line = ''
for x in range (0, im.size[0]):
# RRRRRGGGGGGBBBBB
#pixel_lcd = (pix[x, y][0] >> 3) << 11
#pixel_lcd |= (pix[x, y][1] >> 2) << 5
#pixel_lcd |= (pix[x, y][2] >> 3)
pixel_lcd = (pix[x, y][0] >> 3) << 11
pixel_lcd |= (pix[x, y][1] >> 2) << 5
pixel_lcd |= (pix[x, y][2] >> 3)
# RRRGGGBB to
# RRR00GGG000BB000
pixel_lcd = (pix[x, y][0] >> 5) << 5
pixel_lcd |= (pix[x, y][1] >> 5) << 2
pixel_lcd |= (pix[x, y][2] >> 6)
line += struct.pack('B', pixel_lcd)
# pixel_lcd = (pix[x, y][0] >> 5) << 5
# pixel_lcd |= (pix[x, y][1] >> 5) << 2
# pixel_lcd |= (pix[x, y][2] >> 6)
line += struct.pack('H', pixel_lcd)
outfile.write(line)
print(str(y) + '/' + str(im.size[1]) + '\r', end="")

0 comments on commit 6a22fbf

Please sign in to comment.