Skip to content

Instantly share code, notes, and snippets.

@antiface
Last active February 15, 2021 16:58
Generates a black to white gradient, from black to white, passing through all the grey values.
import time
import random
from PIL import Image
LINE = []
for i in range(256):
LINE.append(i)
MATRIX = LINE*256
nixel = iter(MATRIX)
def noisefield():
im = Image.new("L", (256, 256))
for x in range(256):
for y in range(256):
im.putpixel((x, y), next(nixel))
im.save('<FILEPATH>'+time.strftime('%Y%m%d%H%M%S')+".png")
im.show()
noisefield()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment