Skip to content

Instantly share code, notes, and snippets.

@stianeikeland
Created July 15, 2013 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stianeikeland/6000414 to your computer and use it in GitHub Desktop.
Save stianeikeland/6000414 to your computer and use it in GitHub Desktop.
import png
import random
imgsize = 900
img = [[random.randint(0, 255) for x in range(imgsize)] for y in range(imgsize)]
f = open('rnd.png', 'wb')
w = png.Writer(imgsize, imgsize, greyscale=True)
w.write(f, img)
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment