Skip to content

Instantly share code, notes, and snippets.

@andreasjansson
Created March 1, 2013 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andreasjansson/5065901 to your computer and use it in GitHub Desktop.
Save andreasjansson/5065901 to your computer and use it in GitHub Desktop.
def add_grain(im, depth=14):
pix = im.load()
width, height = im.size
pix = im.load()
for y in xrange(height):
for x in xrange(width):
pix[x, y] = tuple(map(lambda x: x + random.randint(-depth, depth),
list(pix[x, y])))
return im
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment