collage/create.py
Victor Westerlund ea0bf2819b Added sys.argv and input
Renamed main.py to create.py

Input and output images can now be defined by passing CLI arguments for input file and output file. An input prompt will appear if either are omitted.

Added comments
2021-04-05 08:52:55 +02:00

21 lines
No EOL
592 B
Python

import sys
from classes.Samples import Samples
from classes.Collage import Collage
from pathlib import Path
force = False # Will generate a new sample set every time when true
# Prompt IO declaration if no CLI arguments provided
if(len(sys.argv) < 2):
input_file = input("Input image (.jpg):\n")
output_file = input("Output image (.jpg):\n")
else:
input_file = sys.argv[1]
output_file = sys.argv[2]
# Load all images from the "samples/" folder
samples = Samples("samples",force)
# Create a collage from the loaded samples
collage = Collage(input_file,samples)
collage.put(output_file)