-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathresizexr.py
47 lines (36 loc) · 1.21 KB
/
resizexr.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
36
37
38
39
40
41
42
43
44
45
46
47
import matplotlib.pyplot as plt
from PIL import Image
import os
'''
image = Image.open(r"Data\In\0\0001.png")
new_image = image.resize((256, 256))
new_image.show()
'''
for img in os.listdir(r"Data\In\0"):
image = Image.open(os.path.join(r"Data\In\0", img))
filename = img[0:4]
new_image = image.resize((256, 256))
path = os.path.join(r"Data\In_New\0", filename + ".png")
new_image.save(path)
print(filename)
for img in os.listdir(r"Data\In\1"):
image = Image.open(os.path.join(r"Data\In\1", img))
filename = img[0:4]
new_image = image.resize((256, 256))
path = os.path.join(r"Data\In_New\1", filename + ".png")
new_image.save(path)
print(filename)
for img in os.listdir(r"Data\In\2"):
image = Image.open(os.path.join(r"Data\In\2", img))
filename = img[0:4]
new_image = image.resize((256, 256))
path = os.path.join(r"Data\In_New\2", filename + ".png")
new_image.save(path)
print(filename)
for img in os.listdir(r"Data\In\3"):
image = Image.open(os.path.join(r"Data\In\3", img))
filename = img[0:4]
new_image = image.resize((256, 256))
path = os.path.join(r"Data\In_New\3", filename + ".png")
new_image.save(path)
print(filename)