Skip to content

Instantly share code, notes, and snippets.

@beans42
Last active July 30, 2020 01:26
Show Gist options
  • Save beans42/3d00f60979a7e20f845fcf8e841005e1 to your computer and use it in GitHub Desktop.
Save beans42/3d00f60979a7e20f845fcf8e841005e1 to your computer and use it in GitHub Desktop.
from PIL import Image, ImageOps
width, height = 3840, 2160 #can be any res
image = Image.new('RGB', (width, height), color = 'white')
pixels = image.load()
for y in range(height):
for x in range(width):
r = int(x / width * 255)
g = int(y / height * 255)
b = int(0.2 * 255)
pixels[x, y] = (r, g, b)
ImageOps.mirror(image).save('rainbow.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment