-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_test_images.py
28 lines (25 loc) · 1.04 KB
/
make_test_images.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
from PIL import Image
import os
import argparse
import globals.global_values as global_values
import globals.global_utils as global_utils
def run_main(num):
'''
:param num: The number of images to make
:return: Nothing but creates the images
'''
global_utils.check_folders(global_values.TEST_FOLDER_NAME)
for i in range(num):
filename = '%d-test-out.png' % (i)
imOut = Image.new("RGB", global_values.TEST_DIMENSIONS, "white")
pixels = imOut.load()
for x in range(imOut.size[0]):
for y in range(imOut.size[1]):
tmp = global_utils.random_color()
pixels[x, y] = (tmp[0], tmp[1], tmp[2])
imOut.save(os.path.join(global_utils.get_input_directory(global_values.TEST_FOLDER_NAME), filename))
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Create Test data')
parser.add_argument('-n', '--number', help='number of test files to create', required=False, type=int, default=5)
args = parser.parse_args()
run_main(args.number)