-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarhol_filter.py
35 lines (30 loc) · 1.02 KB
/
warhol_filter.py
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
32
33
34
35
"""
This program generates the Warhol effect based on the original image.
"""
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():
final_image = SimpleImage.blank(WIDTH, HEIGHT)
# TODO: your code here.
# This is an example which should generate a pinkish patch
patch = make_recolored_patch(1.5, 0, 1.5)
final_image.show()
def make_recolored_patch(red_scale, green_scale, blue_scale):
'''
Implement this function to make a patch for the Warhol Filter. It
loads the patch image and recolors it.
:param red_scale: A number to multiply each pixels' red component by
:param green_scale: A number to multiply each pixels' green component by
:param blue_scale: A number to multiply each pixels' blue component by
:return: the newly generated patch
'''
patch = SimpleImage(PATCH_NAME)
# TODO: your code here.
return patch
if __name__ == '__main__':
main()