// Seamlessy load single files, list of files and files from directories.
if len(source) and os.path.isdir(source[0]):
source_fns = sorted(
glob.glob("{}/*.{}".format(source[0], image_format)))
else:
source_fns = source
After Change
if isinstance(source, str):
if os.path.isdir(source):
source_fns = sorted(
glob.glob("{}/*.{}".format(source, image_format)))
elif os.path.isfile(source):
source_fns = [source]
assert(all([is_image_file(f) for f in source_fns])), "Given files contain files with unsupported format"