-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha.py
More file actions
45 lines (40 loc) · 707 Bytes
/
Copy patha.py
File metadata and controls
45 lines (40 loc) · 707 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import numpy as np
from PIL import Image as im
'''
#for delay
from time import sleep
'''
img = im.open("b.jpeg")
print (type(img))
img = np.array(img)
print (type(img))
x, y, ch = img.shape
"""
#Re-color
for i in range(x):
for j in range(y):
for k in range(ch):
if (i < x//4) or (i > y*3//4):
img[i,j,k] = 0
"""
#crop in circle
for i in range(x):
for j in range(y):
for k in range(ch):
if ((i-x//2)**2 + (j+y//2)**2) == (x//2)**2:
img[i,j,k] = 50
# else:
# img[i,j,k] = 0
'''
#to crop image in square shape
img[:500,:120,:]=50
img[380:,:500,:]=50
img[:120,:500,:]=50
img[:500,380:,:]=50
'''
'''
print (img)
img = img * 9500
'''
img = im.fromarray(img)
img.save("abc.jpeg")