How do I convert a list of 1D numbers to a bitmap image?
I tried the following but it seems it doesn't quite work.
from PIL import Image
def get_img():
img = Image.new('RGB', (255,255), "black") # Create a new black image
pixels = img.load() # Create the pixel map
width, height = img.size
for i in range(width): # For every pixel:
for j in range(height):
pixels[i,j] = (i, j, 100) # Set the colour accordingly
return pixels
display(get_img()) # <PixelAccess at 0x7fca63ded7d0>
