<jupyter_start><jupyter_text>---------------------------------------------<jupyter_code>target_image = Image.open(args.target)<jupyter_output><empty_output><jupyter_text>input images<jupyter_code>print('reading input folder...')
input_images = getImages(args.images)<jupyter_output>reading input folder...<jupyter_text>check if any valid input images found<jupyter_code>if input_images == []:
    print('No input images found in %s. Exiting.' % (args.images,))
    exit()<jupyter_output><empty_output><jupyter_text>shuffle list - to get a more varied output?<jupyter_code>random.shuffle(input_images)<jupyter_output><empty_output><jupyter_text>size of grid<jupyter_code>grid_size = (int(args.grid[1]), int(args.grid[0]))
grid_size<jupyter_output><empty_output><jupyter_text>output<jupyter_code>output_filename = 'mosaic.jpeg'
if args.output:
    output_filename = args.output<jupyter_output><empty_output><jupyter_text>re-use any image in input<jupyter_code>reuse_images = args.reuse<jupyter_output><empty_output><jupyter_text>resize the input to fit original image size?<jupyter_code>resize_input = args.resize
print('starting photomosaic creation...')<jupyter_output>starting photomosaic creation...<jupyter_text>if images can't be reused, ensure m*n <= num_of_images<jupyter_code>if not reuse_images:
    if grid_size[0] * grid_size[1] > len(input_images):
        print('grid size less than number of images')
        exit()<jupyter_output><empty_output><jupyter_text>resizing input<jupyter_code>if resize_input:
    print('resizing images...')
    # for given grid size, compute max dims w,h of tiles
    dims = (int(target_image.size[0] / grid_size[1]),
            int(target_image.size[1] / grid_size[0]))
    print("max tile dims: %s" % (dims,))
    # resize
    for img in input_images:
        img.thumbnail(dims)<jupyter_output>resizing images...
max tile dims: (2, 2)<jupyter_text>create photomosaic<jupyter_code>mosaic_image = createPhotomosaic(target_image, input_images, grid_size, reuse_images)<jupyter_output>processed 4000 of 40000...
processed 8000 of 40000...
processed 12000 of 40000...
processed 16000 of 40000...
processed 20000 of 40000...<jupyter_text>write out mosaic<jupyter_code>mosaic_image.save(output_filename, 'png')
print("saved output to %s" % (output_filename,))
print('done.')<jupyter_output>saved output to E:\Documents\GitHub\Photo_Mosaic\data\mosaic_image.jpeg
done.
{'fraction_non_alphanumeric': 0.1400665004156276, 'fraction_numerical': 0.024106400665004156, 'mean_word_length': 5.686111111111111, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '354919', 'license': 'MIT', 'n_tokens_mistral': 913, 'n_tokens_neox': 835, 'n_words': 154, 'path': 'scripts/Mosaic_Creator.ipynb', 'repo_name': 'ChrisCatanese/Photo_Mosaic', 'size': '2406'}