标签:生成 inf put col pen lis open eva cep
aa-1.log
链接:https://pan.baidu.com/s/1bEbXeJtRF792DX0x8TGwhA 密码:zwky
#coding=utf-8 import time from PIL import Image with open("aa-1.log","r") as f: costlist=eval(f.read()) img = Image.new("RGB",(675,792))###创建图片 print(len(costlist)) single=[] count=0 output=[] for i in range(675): y=[] for j in range(792): try: if(costlist[count]=="[" or costlist[count]=="]"): print(costlist[count]) x=int(costlist[count]) #if(x not in single): #single.append(x) if(x<0): pixTuple = (105,105,105,x) img.putpixel((i,j),pixTuple) elif(x<25): pixTuple = (255,255,255,x) img.putpixel((i,j),pixTuple) elif(x<65): pixTuple = (211,211,211,x) img.putpixel((i,j),pixTuple) else: pixTuple = (0,0,0,x) img.putpixel((i,j),pixTuple) count+=1 y.append(x) except Exception as e: print(e,i,j) output.append(y) with open("aa.log","w") as f: f.write(str(output).replace("[","{").replace("]","}")) pixTuple = (255,0,0,0) img.putpixel((337,300),pixTuple) img.save("bb.png") #print(single)
效果图
标签:生成 inf put col pen lis open eva cep
原文地址:https://www.cnblogs.com/sea-stream/p/11100402.html