Created
May 10, 2022 22:04
-
-
Save carl-mastrangelo/7e73a77cbd5960f775306f1f4691f8d6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python3 | |
from PIL import Image | |
from math import sin, cos, pi | |
width = 1440 | |
height = 800 | |
midw = width / 2 | |
midh = height / 2 | |
lesser = min(midw, midh) | |
img = Image.new("RGB", (width, height), color=0) | |
for x in range(width): | |
for y in range(height): | |
dist = (((x - midw)**2 + (y - midh)**2) **.5) / lesser | |
val = cos((2** (dist* 2)) * pi * 10) | |
val = round((val + 1) * 255 / 2) | |
img.putpixel((x, y), (val, val, val)) | |
img.save("img.png", "PNG") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment