Skip to content

Instantly share code, notes, and snippets.

@MaxMorais
Forked from glenrobertson/white_noise_image.py
Created April 2, 2013 22:11
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 MaxMorais/5296668 to your computer and use it in GitHub Desktop.
Save MaxMorais/5296668 to your computer and use it in GitHub Desktop.
from PIL import Image
def get_white_noise_image(width, height):
pil_map = Image.new("RGBA", (width, height), 255)
random_grid = map(lambda x: (
int(random.random() * 256),
int(random.random() * 256),
int(random.random() * 256)
), [0] * width * height)
pil_map.putdata(random_grid)
return pil_map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment