-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblue_screen.py
More file actions
31 lines (26 loc) · 827 Bytes
/
blue_screen.py
File metadata and controls
31 lines (26 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from simpleimage import SimpleImage
N_ROWS = 2
N_COLS = 3
PATCH_SIZE = 222
WIDTH = N_COLS * PATCH_SIZE
HEIGHT = N_ROWS * PATCH_SIZE
PATCH_NAME = 'images/simba-sq.jpg'
def main():
image = SimpleImage.blank(WIDTH, HEIGHT)
for a in range(N_ROWS):
for i in range(N_COLS):
for y in range(PATCH_SIZE):
for x in range(PATCH_SIZE):
patch = make_recolored_patch()
pixel = patch.get_pixel(x,y)
image.set_pixel(x + (i*PATCH_SIZE), y + (a*PATCH_SIZE), pixel)
image.show()
def make_recolored_patch():
patch = SimpleImage(PATCH_NAME)
for pixel in patch:
pixel.red = pixel.red * 1.5
pixel.green = pixel.green * 0
pixel.blue = pixel.blue * 1.5
return patch
if __name__ == '__main__':
main()