From the class Code as a Liberal Art · Spring 2022
sandbox/sandbox.py
import sys
from PIL import Image
if len(sys.argv) != 2:
exit("This program requires one argument: the name of the image file that will be created.")
# Make a new 400x400 image
img = Image.new("RGB", (400,400) )
data = []
for i in range(160000):
pixel = (i%7, i%20, i%2002)
data.append( pixel )
img.putdata(data)
img.save(sys.argv[1])