
Untitled
By: a guest on
Jul 10th, 2012 | syntax:
None | size: 0.46 KB | hits: 13 | expires: Never
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from itertools import izip
from datetime import datetime
from PIL import Image
from numpy.random import randint
x, y = 2560, 1920
def grouper(n, iterable):
args = [iter(iterable)] * n
return izip(*args)
def rndnumpy(pixels):
rand = randint(0, 255, pixels*3)
return grouper(3, rand)
img = Image.new('RGB', (x, y))
img.putdata(list(rndnumpy(x*y)))
img.save(datetime.now().strftime('IMG_%Y%m%d_%H%M%S.jpg'))