Created
April 3, 2012 00:05
-
-
Save glenrobertson/2288152 to your computer and use it in GitHub Desktop.
get PIL white noise image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
It is much cheaper to do: