Update generate_world_map.bin.py (#640)

Use bytes instead of strings to write ADSB map binary for python3
This commit is contained in:
MattLodge 2022-05-08 20:27:15 +01:00 committed by GitHub
parent de1570d8af
commit 6c5f8a38e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ outfile.write(struct.pack('H', im.size[1]))
print("Generating: \t" + outfile.name + "\n from\t\t" + im.filename + "\n please wait...");
for y in range (0, im.size[1]):
line = ''
line = b''
for x in range (0, im.size[0]):
# RRRRRGGGGGGBBBBB
pixel_lcd = (pix[x, y][0] >> 3) << 11
@ -47,8 +47,8 @@ for y in range (0, im.size[1]):
# pixel_lcd = (pix[x, y][0] >> 5) << 5
# pixel_lcd |= (pix[x, y][1] >> 5) << 2
# pixel_lcd |= (pix[x, y][2] >> 6)
line += str(struct.pack('H', pixel_lcd))
outfile.write(line.encode('utf-8'))
line += struct.pack('H', pixel_lcd)
outfile.write(line)
print(str(y) + '/' + str(im.size[1]) + '\r', end="")
print("Ready.");