rainbow
This commit is contained in:
@@ -0,0 +1,52 @@
|
|||||||
|
import random
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
width = 1280
|
||||||
|
height = 720
|
||||||
|
|
||||||
|
img = Image.new("RGB", (width, height))
|
||||||
|
|
||||||
|
pixels = img.load()
|
||||||
|
|
||||||
|
colors = (
|
||||||
|
(0xFF, 0x00, 0x00),
|
||||||
|
(0xFF, 0x7F, 0x00),
|
||||||
|
(0xFF, 0xFF, 0x00),
|
||||||
|
(0x00, 0xFF, 0x00),
|
||||||
|
(0x00, 0xFF, 0xFF),
|
||||||
|
(0x00, 0x00, 0xFF),
|
||||||
|
(0x8B, 0x00, 0xFF),
|
||||||
|
(0xFF, 0x00, 0xFF)
|
||||||
|
)
|
||||||
|
colors2 = (
|
||||||
|
(0xFF,0x00,0x00),
|
||||||
|
(0xFF,0x40,0x00),
|
||||||
|
(0xFF,0x80,0x00),
|
||||||
|
(0xFF,0xBF,0x00),
|
||||||
|
(0xFF,0xFF,0x00),
|
||||||
|
(0xBF,0xFF,0x00),
|
||||||
|
(0x80,0xFF,0x00),
|
||||||
|
(0x00,0xFF,0x00),
|
||||||
|
(0x00,0xFF,0x80),
|
||||||
|
(0x00,0xFF,0xFF),
|
||||||
|
(0x00,0x80,0xFF),
|
||||||
|
(0x00,0x00,0xFF),
|
||||||
|
(0x40,0x00,0xFF),
|
||||||
|
(0x80,0x00,0xFF),
|
||||||
|
(0xFF,0x00,0xFF),
|
||||||
|
(0xFF,0x00,0x80)
|
||||||
|
)
|
||||||
|
|
||||||
|
for y in range(height):
|
||||||
|
for x in range(width):
|
||||||
|
pixels[x, y] = colors[((x+y)>>4)&7]
|
||||||
|
|
||||||
|
img.save("output/rainbow.png")
|
||||||
|
img.show()
|
||||||
|
|
||||||
|
for y in range(height):
|
||||||
|
for x in range(width):
|
||||||
|
pixels[x, y] = colors2[((x+y)>>4)&15]
|
||||||
|
|
||||||
|
img.save("output/rainbow2.png")
|
||||||
|
img.show()
|
||||||
Reference in New Issue
Block a user