import math
import random
from PIL import Image
RES_X=1024
RES_Y=1024
def pixel(x,y):
if math.floor(x/256)%2 == 0:
red = x % 256
else:
red = 256 - (x%256)
if math.floor(y/256)%2 == 0:
blue = y % 256
else:
blue = 256 - (y%256)
green = math.floor(math.sqrt(red*blue))
if y-100 < x < y + 100 :
blue -= 50
red -= 50
if y-100 < RES_X-x < y + 100 :
blue += 50
red += 50
return (math.floor(red), math.floor(green), math.floor(blue))
img = Image.new("RGB",(RES_X,RES_Y))
for x in range(RES_X):
for y in range(RES_Y):
img.putpixel((x,y),pixel(x,y))
img.save("result.png")