📜  python如何制作png - Python代码示例

📅  最后修改于: 2022-03-11 14:46:23.701000             🧑  作者: Mango

代码示例1
import png
s = ['110010010011',
     '101011010100',
     '110010110101',
     '100010010011']
s = [[int(c) for c in row] for row in s]

w = png.Writer(len(s[0]), len(s), greyscale=True, bitdepth=1)
f = open('png.png', 'wb')
w.write(f, s)
f.close()

# https://pypng.readthedocs.io/en/latest/ex.html