打开txt文件是一串RGB颜色值

用len(file.readlines()),发现颜色值有61366个,能分解成122*503

 from PIL import Image
length = 122
width = 503
pic = Image.new("RGB",(length, width))
file = open('/Users/.../Desktop/misc100.txt')
l = file.readlines()
for y in range (0,width):
i = 1
for x in range (0,length):
s = l[(y+1)*122-i]
a,b,c = s.split(',')
pic.putpixel([x,y],(int(a),int(b),int(c)))
i += 1
pic = pic.rotate(90)
pic.show()
05-12 15:18