def erzeuge_pollenkarte(matrix):
breite = len(matrix)
hoehe = len(matrix[0])
matrix2 = []
for x in range(breite):
zeile = []
for y in range(hoehe):
wert = matrix[x][y]
#rgba = (wert, wert, wert, 0.1)
#zeile.append(rgba)
zeile.append(0xCC)
zeile.append(0)
zeile.append(0)
zeile.append(wert)
matrix2.append(zeile)
image = png.from_array(matrix2, 'RGBA')
image.save('pollenkarte.png')
# png_file = open('pollenkarte.png', 'wb')
# png_writer = png.Writer(width=breite, height=hoehe, alpha=True, bitdepth=8)
# #greyscale=True,
# #for daten in matrix:
# # png_writer.write(png_file, daten)
# png_writer.write(png_file, matrix2)
# png_file.close()
评论列表
文章目录