I have file have some value like this "01100000,10101000,01101000,01110000,10101100,01110000,01101000,10101 " this is the value of JPEG image (120*160)and I need to convert this file to image, I'm trying with this code but I have this error!
pixels[x,y] = diff(i2) #Creates a black image. What do? TypeError: color must be int or tuple
with open("C://Users//kk//Desktop//rbb8bin.txt") as file:
vdiv = [line.strip() for line in file]
print(vdiv)
def diff(inp):
if inp == '1':
return (0,0,0)
if inp == '0':
return (255,255,255)
else:
pass
img = Image.new( 'RGB', (8,len(vdiv)), "white")
pixels = img.load()
for x in range(img.size[0]):
for y in range(img.size[1]):
for i in vdiv:
for i2 in i:
pixels[x,y] = diff(i2) #Creates a black image. What do?
img.show()
