All pastes #906691 Raw Edit

Stuff

public python v1 · immutable
·published 2008-02-16 22:05 UTC
rendered paste body
import Imageimport ImageDrawimport randomdef RandomColor():	red = random.randint(1,255)	green = random.randint(1,255)	blue = random.randint(1,255)	return (red, green, blue)url = 'http://path.to.some.image/'import urllibfname = urllib.urlretrieve(url, 'imagename.ext')[0]im = Image.open(fname)sizex = im.size[0]sizey = im.size[1]draw = ImageDraw.Draw(im)for i in range(1000):	rndcol = RandomColor()	x = random.randint(50, sizex-100)	y = random.randint(50, sizey-100)		newx = x + (random.randint(15,50))	newy = y + (random.randint(15,50))		draw.rectangle([(x,y), (newx, newy)], outline= rndcol)im.save('wallpaper.png', 'png')im.show()