绘制二维码

#coding:utf8
#根据坐标绘制二维码
from PIL import Image
MAX = 289 #边长
pic = Image.new("RGB",(MAX, MAX),(255, 255, 255)) #默认为全白色
f=open('a.txt')
c=f.readlines()
f.close()
for i in c:
    x=int(i.split(',')[0].replace('(',''))
    y=int(i.split(',')[1].replace(')','').replace('\n',''))
    pic.putpixel([x,y],(0, 0, 0)) #坐标处画黑
pic.show()
pic.save("flag.png")