I wish to draw an image based on computed pixel values, as a means to visualize some data. Essentially, I wish to take a 2-dimensional matrix of color triplets and render it
import Image im= Image.new('RGB', (1024, 1024)) im.putdata([(255,0,0), (0,255,0), (0,0,255)]) im.save('test.png')
Puts a red, green and blue pixel in the top-left of the image.
im.fromstring() is faster still if you prefer to deal with byte values.
im.fromstring()