![]() |
Procedural texture synthesis by A.G. (c) 2017. All Rights Reserved. |
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
import time | |
import random | |
from PIL import Image | |
def noisefield(): | |
im = Image.new("L", (256, 256)) | |
for x in range(256): | |
for y in range(256): | |
im.putpixel((x, y), nixel.next()) | |
im.save(FILEPATH+time.strftime('%Y%m%d%H%M%S')+".png") | |
im.show() | |
l1 = [0,0,0,0,0,0,0,0,0,0] # (L for List) | |
l2 = [255,255,255,255,255,255,255,255,255,255] | |
l3 = [] | |
# I am randomly choosing lists of 10 items I created to generate my one-dimensional | |
# vector/array of 65536 items, to make a 256 pixel by 256 pixel image | |
# with random stretches of all-white OR all-black pixels. | |
for i in range(6554): | |
l3.extend(random.choice([l1,l2])) | |
# len(l3) = 65540, therefore I must crop it. | |
l3 = l3[0:65536] | |
nixel = iter(l3) |
...
No comments:
Post a Comment